void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { other.GetComponent <playerController>().getDamage(); } else if (other.tag == "CannonFoot") { cannonFoot cf = other.GetComponent <cannonFoot>(); cf.decreaseHealth(); } //Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { //resume } else if (other.tag == "CannonFoot") { cannonFoot cf = other.GetComponent <cannonFoot>(); cf.decreaseHealth(); Destroy(gameObject); } else if (other.tag == "Enemy") { // Debug.Log("enemy"); enemyAI ea = other.GetComponent <enemyAI>(); ea.dealDmg(); Destroy(gameObject); } }