void Awake() { _caster = GetComponent <AbilityCaster>(); _eventHandler = GetComponent <EventHandler>(); _targeting = GetComponent <CharacterTargeting>(); _floatingText = GetComponent <CharacterFloatingText>(); _meleeVector = GetComponent <CharacterMeleeVector>(); AttackPower = _template.AttackPower; Armor = _template.Armor; Health = _template.Health; Dead = false; }
public override EventHandler[] GetTargets(AbilityCaster caster) { CharacterMeleeVector meleeVector = caster.EventHandler.GetComponent <Character>().MeleeVector; if (meleeVector == null) { Debug.LogWarning("Caster has no melee vector."); return(new EventHandler[0]); } Collider[] targetColliders = Physics.OverlapSphere(meleeVector.HitTransform.position, meleeVector.HitRadius, _layer); EventHandler[] targets = targetColliders.Select(collider => collider.GetComponent <EventHandler>()).ToArray(); targets = targets.Where(target => target != caster.GetComponent <EventHandler>()).ToArray(); return(targets); }