编队系统重置 选角页面基本完成 等待存入playerprefs
This commit is contained in:
@@ -55,6 +55,28 @@ public class EffectSystem : MonoBehaviour
|
||||
StartCoroutine(ApplyDamageOverTimeCoroutine(t, amount, duration, tickInterval, source));
|
||||
break;
|
||||
|
||||
case EffectType.HealSingleEnemy:
|
||||
// heal single enemy (first target)
|
||||
if (targets.Count > 0)
|
||||
ApplyInstantHeal(targets[0], amount, source);
|
||||
break;
|
||||
|
||||
case EffectType.HealOverTimeEnemy:
|
||||
foreach (var t in targets)
|
||||
StartCoroutine(ApplyHealOverTimeCoroutine(t, amount, duration, tickInterval, source));
|
||||
break;
|
||||
|
||||
case EffectType.DamageSingleAlly:
|
||||
// damage a single ally (first target)
|
||||
if (targets.Count > 0)
|
||||
ApplyInstantDamage(targets[0], amount, source);
|
||||
break;
|
||||
|
||||
case EffectType.DamageOverTimeAlly:
|
||||
foreach (var t in targets)
|
||||
StartCoroutine(ApplyDamageOverTimeCoroutine(t, amount, duration, tickInterval, source));
|
||||
break;
|
||||
|
||||
case EffectType.HealSingleSelf:
|
||||
if (targets.Count > 0)
|
||||
ApplyInstantHeal(targets[0], amount, source);
|
||||
@@ -163,7 +185,6 @@ public class EffectSystem : MonoBehaviour
|
||||
list.AddRange(FindAllAllies());
|
||||
if (source != null)
|
||||
list.RemoveAll(g => g == null || g == source || g.gameObject == source.gameObject);
|
||||
list.RemoveAll(g => g == null || g == source);
|
||||
break;
|
||||
|
||||
case Selector.AdjacentAllies:
|
||||
@@ -291,17 +312,30 @@ public class EffectSystem : MonoBehaviour
|
||||
private IEnumerable<GameObject> FindAllEnemies()
|
||||
{
|
||||
List<GameObject> enemies = new List<GameObject>();
|
||||
// try to find object named "thisEnemy" (single) or many by tag
|
||||
var single = GameObject.Find("thisEnemy");
|
||||
if (single != null) enemies.Add(single);
|
||||
|
||||
// Prefer explicit EnemyCombatant components (more robust than tags)
|
||||
try
|
||||
{
|
||||
var comps = GameObject.FindObjectsOfType<EnemyCombatant>(true);
|
||||
foreach (var c in comps)
|
||||
{
|
||||
if (c != null && c.gameObject != null && !enemies.Contains(c.gameObject)) enemies.Add(c.gameObject);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Also include a single named instance if present
|
||||
var single = GameObject.Find("thisEnemy");
|
||||
if (single != null && !enemies.Contains(single)) enemies.Add(single);
|
||||
|
||||
// Finally include any objects tagged "Enemy" (if tag exists)
|
||||
try
|
||||
{
|
||||
var tagged = GameObject.FindGameObjectsWithTag("Enemy");
|
||||
foreach (var g in tagged)
|
||||
if (!enemies.Contains(g)) enemies.Add(g);
|
||||
}
|
||||
catch { }
|
||||
catch { /* ignore missing tag */ }
|
||||
|
||||
return enemies;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user