MusicBeat
This commit is contained in:
@@ -15,7 +15,7 @@ namespace Cielonos.MainGame
|
||||
/// </summary>
|
||||
public struct TargetingScore
|
||||
{
|
||||
public CharacterBase target;
|
||||
public Enemy target;
|
||||
/// <summary>最终评分 = baseScore + bonusScore。</summary>
|
||||
public float totalScore;
|
||||
/// <summary>基础加权评分(由 GetScoredEnemies 计算,不受后续修正影响)。</summary>
|
||||
@@ -61,7 +61,7 @@ namespace Cielonos.MainGame
|
||||
origin = Player.transform;
|
||||
}
|
||||
|
||||
List<CharacterBase> candidates = GetEnemiesInRadius(origin.position, radius);
|
||||
List<Enemy> candidates = GetEnemiesInRadius(origin.position, radius);
|
||||
if (candidates.Count == 0) return new List<TargetingScore>();
|
||||
|
||||
Camera camera = Player.viewSc.playerCamera;
|
||||
@@ -111,7 +111,7 @@ namespace Cielonos.MainGame
|
||||
|
||||
List<TargetingScore> results = new List<TargetingScore>(candidates.Count);
|
||||
|
||||
foreach (CharacterBase enemy in candidates)
|
||||
foreach (Enemy enemy in candidates)
|
||||
{
|
||||
if (enemy == null || enemy.statusSm.isDead) continue;
|
||||
|
||||
@@ -178,11 +178,11 @@ namespace Cielonos.MainGame
|
||||
/// <summary>
|
||||
/// 综合索敌的便捷方法:返回评分最高的单个敌人。
|
||||
/// </summary>
|
||||
public CharacterBase GetBestEnemy(float radius, Transform origin = null, Func<CharacterBase> overrideCandidate = null)
|
||||
public Enemy GetBestEnemy(float radius, Transform origin = null, Func<Enemy> overrideCandidate = null)
|
||||
{
|
||||
if (overrideCandidate != null)
|
||||
{
|
||||
CharacterBase oc = overrideCandidate();
|
||||
Enemy oc = overrideCandidate();
|
||||
if (oc != null)
|
||||
{
|
||||
return oc;
|
||||
@@ -196,10 +196,10 @@ namespace Cielonos.MainGame
|
||||
/// <summary>
|
||||
/// 综合索敌的便捷方法:返回评分前 N 的敌人列表。
|
||||
/// </summary>
|
||||
public List<CharacterBase> GetBestEnemies(float radius, int count, Transform origin = null)
|
||||
public List<Enemy> GetBestEnemies(float radius, int count, Transform origin = null)
|
||||
{
|
||||
List<TargetingScore> scores = GetScoredEnemies(radius, origin);
|
||||
List<CharacterBase> result = new List<CharacterBase>(Mathf.Min(count, scores.Count));
|
||||
List<Enemy> result = new List<Enemy>(Mathf.Min(count, scores.Count));
|
||||
for (int i = 0; i < scores.Count && i < count; i++)
|
||||
{
|
||||
result.Add(scores[i].target);
|
||||
@@ -214,7 +214,7 @@ namespace Cielonos.MainGame
|
||||
{
|
||||
return GetBestEnemy(50f, null, ReturnLockon);
|
||||
|
||||
CharacterBase ReturnLockon()
|
||||
Enemy ReturnLockon()
|
||||
{
|
||||
LockTargetSubmodule lockModule = MainGameManager.Player.viewSc.lockTargetModule;
|
||||
if (lockModule.isLocking && lockModule.lockTarget != null)
|
||||
@@ -229,17 +229,17 @@ namespace Cielonos.MainGame
|
||||
|
||||
public partial class EnemySubmodule
|
||||
{
|
||||
public CharacterBase GetNearestEnemy(float radius, Transform origin = null)
|
||||
public Enemy GetNearestEnemy(float radius, Transform origin = null)
|
||||
{
|
||||
origin ??= Player.transform;
|
||||
List<CharacterBase> candidates = GetEnemiesInRadius(origin.position, radius);
|
||||
List<Enemy> candidates = GetEnemiesInRadius(origin.position, radius);
|
||||
return candidates.FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<CharacterBase> GetNearestEnemies(float radius, int count, Transform origin = null)
|
||||
public List<Enemy> GetNearestEnemies(float radius, int count, Transform origin = null)
|
||||
{
|
||||
origin ??= Player.transform;
|
||||
List<CharacterBase> candidates = GetEnemiesInRadius(origin.position, radius);
|
||||
List<Enemy> candidates = GetEnemiesInRadius(origin.position, radius);
|
||||
return candidates.Take(count).ToList();
|
||||
}
|
||||
}
|
||||
@@ -249,11 +249,11 @@ namespace Cielonos.MainGame
|
||||
{
|
||||
public static List<CombatManager.EnemySubmodule.TargetingScore> ApplyScoreModifier(
|
||||
this List<CombatManager.EnemySubmodule.TargetingScore> scores,
|
||||
List<CharacterBase> boostTargets, float amplifier, float offset = 0)
|
||||
List<Enemy> boostTargets, float amplifier, float offset = 0)
|
||||
{
|
||||
return scores.ApplyScoreModifier(Predicate, amplifier, offset);
|
||||
|
||||
bool Predicate(CharacterBase target)
|
||||
bool Predicate(Enemy target)
|
||||
{
|
||||
return boostTargets != null && boostTargets.Contains(target);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ namespace Cielonos.MainGame
|
||||
|
||||
public static List<CombatManager.EnemySubmodule.TargetingScore> ApplyScoreModifier(
|
||||
this List<CombatManager.EnemySubmodule.TargetingScore> scores,
|
||||
Predicate<CharacterBase> match, float amplifier, float offset = 0)
|
||||
Predicate<Enemy> match, float amplifier, float offset = 0)
|
||||
{
|
||||
bool changed = false;
|
||||
for (int i = 0; i < scores.Count; i++)
|
||||
@@ -283,14 +283,14 @@ namespace Cielonos.MainGame
|
||||
return scores;
|
||||
}
|
||||
|
||||
public static CharacterBase BestEnemy(this List<CombatManager.EnemySubmodule.TargetingScore> scores)
|
||||
public static Enemy BestEnemy(this List<CombatManager.EnemySubmodule.TargetingScore> scores)
|
||||
{
|
||||
return scores.Count > 0 ? scores[0].target : null;
|
||||
}
|
||||
|
||||
public static List<CharacterBase> BestEnemies(this List<CombatManager.EnemySubmodule.TargetingScore> scores, int count)
|
||||
public static List<Enemy> BestEnemies(this List<CombatManager.EnemySubmodule.TargetingScore> scores, int count)
|
||||
{
|
||||
List<CharacterBase> result = new List<CharacterBase>(Mathf.Min(count, scores.Count));
|
||||
List<Enemy> result = new List<Enemy>(Mathf.Min(count, scores.Count));
|
||||
for (int i = 0; i < scores.Count && i < count; i++)
|
||||
{
|
||||
result.Add(scores[i].target);
|
||||
|
||||
Reference in New Issue
Block a user