private void Attack() { //speed is now 0 agent.speed = 0; //count down to attack timer -= Time.deltaTime; //If the timer is at 0 if (timer <= 0) { //reset the timer timer = attackspeed; //Attack if (info.cleave) { List <GameObject> targets = new List <GameObject> { }; if (info.player) { foreach (GameObject g in TeamList.teamB.ToList()) { if (Vector3.Distance(this.gameObject.transform.position, g.transform.position) < 1.5f * g.GetComponent <CharacterInfo>().size.value) { targets.Add(g); } BasicAttack.Go(this.gameObject, targets.ToList()); } } } else { BasicAttack.Go(this.gameObject, target); } } }