void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") { Destroy(collision.gameObject); } if (collision.gameObject.tag == "Ally") { AllyMovement allyController = (AllyMovement)collision.gameObject.GetComponent(typeof(AllyMovement)); allyController.DestroySelf(); } Destroy(gameObject); }
void Awake() { nav = GetComponent <NavMeshAgent>(); move = GetComponent <AllyMovement>(); }
void Awake() { shootScript = GetComponent <AllyShooting>(); move = GetComponent <AllyMovement>(); targets = new GameObject[10]; }