void RageEffect() { Collider[] colliders = Physics.OverlapSphere(transform.position, spellRadius); //List<TroopsManager> troops = new List<TroopsManager>(); foreach (Collider insideCollider in colliders) { TroopsManager troops = insideCollider.GetComponent <TroopsManager>(); if (troops != null) { //ragedTroops.Add(troops); //troops.inSideAnotherRage = true; troops.Rage(damageIncrease, speedIncrease, this.gameObject); } //else if(troops != null && (transform.position - troops.transform.position).sqrMagnitude > spellRadius) //{ // Debug.Log("moved"); // troops.RemoveRageEffect(); //} } //foreach(TroopsManager troops in allTroops) //{ // if (troops != null && (transform.position - troops.transform.position).sqrMagnitude > spellRadius) // { // //Debug.Log("moved"); // troops.RemoveRageEffect(); // } //} }
void HealEffect() { Collider[] colliders = Physics.OverlapSphere(transform.position, spellRadius); //List<TroopsManager> troops = new List<TroopsManager>(); foreach (Collider insideCollider in colliders) { TroopsManager troops = insideCollider.GetComponent <TroopsManager>(); if (troops != null) { troops.Heal(healAmount); } } }