private void SpawnProjectilesForTargets(AbilityData data, Vector3 spawnPosition) { foreach (var target in data.GetTargets()) { Health health = target.GetComponent <Health>(); if (health) { Projectile projectile = Instantiate(projectileToSpawn); projectile.transform.position = spawnPosition; projectile.SetTarget(health, data.GetUser(), damage); } } }
public override void StartEffect(AbilityData data, Action finished) { foreach (var target in data.GetTargets()) { var health = target.GetComponent <Health>(); if (health) { if (healthChange < 0) { health.TakeDamage(data.GetUser(), -healthChange); } else { health.Heal(healthChange); } } } finished(); }
private void SpawnProjectilesForTargets(AbilityData data, Vector3 spawnPosition) { int count = 0; foreach (var target in data.GetTargets()) { if (count >= maxNumberOfTargets) { break; } Health health = target.GetComponent <Health>(); if (health) { Projectile projectile = Instantiate(projectileToSpawn); projectile.transform.position = spawnPosition; projectile.SetTarget(health, data.GetUser(), damage); count++; } } }