protected override void OnTriggerEnter(Collider collider) { Unit unitHit = GetUnitHit(collider); if (unitHit != null && CanAffectTarget(unitHit)) { UnitsAlreadyHit.Add(unitHit); OnAbilityEffectHitTarget(unitHit, isACriticalStrike, willMiss); } }
protected override void OnTriggerEnter(Collider collider) { if (!alreadyHitATarget && collider == targetCollider) { UnitsAlreadyHit.Add(target); OnAbilityEffectHitTarget(target, isACriticalStrike, willMiss); alreadyHitATarget = true; GetComponent <Collider>().enabled = false; } }
protected override void OnTriggerEnter(Collider collider) { Unit unitHit = collider.gameObject.GetComponent <Unit>(); if (unitHit != null && CanAffectTarget(unitHit)) { UnitsAlreadyHit.Add(unitHit); OnAbilityEffectHitTarget(unitHit); } }
protected bool alreadyHitATarget;//This is to prevent OnTriggerEnter to cast multiple times if multiple targets enter the collider at the same time protected override void OnTriggerEnter(Collider collider) { if (!alreadyHitATarget) { Unit unitHit = GetUnitHit(collider); if (unitHit != null && CanAffectTarget(unitHit)) { UnitsAlreadyHit.Add(unitHit); OnAbilityEffectHitTarget(unitHit, isACriticalStrike, willMiss); alreadyHitATarget = true; GetComponent <Collider>().enabled = false; } } }