private void OnTriggerEnter2D(Collider2D otherCollider) { GameObject otherObject = otherCollider.gameObject; if (otherObject.GetComponent <Attacker>()) { healthDisplay.EnemyReachesBase(); Destroy(otherObject); } }