public void InsertInList(Collider col) { if (col.CompareTag("EnemyUndead")) { UndeadController undead = col.GetComponent <UndeadController>(); undead.chasing = true; enemies.Add(col.gameObject); } else if (col.CompareTag("EnemyRange")) { ShooterController range = col.GetComponent <ShooterController>(); range.chasing = true; enemies.Add(col.gameObject); } }
void DesactivateChaseArea() { foreach (GameObject GO in enemies) { if (GO.CompareTag("EnemyUndead")) { UndeadController undead = GO.GetComponent <UndeadController>(); undead.chasing = false; } else if (GO.CompareTag("EnemyRange")) { ShooterController range = GO.GetComponent <ShooterController>(); range.chasing = false; } } enemies.Clear(); isCreated = false; }