private void OnTriggerEnter2D(Collider2D otherCollider2D) { //Enemy Projectile if (otherCollider2D.CompareTag("Player") && !gameObject.CompareTag("Projectile_P")) { StateManager playerState = otherCollider2D.gameObject.GetComponent <StateManager>(); playerState.TakeDamage(Damage); } //Meteor/Asteroid - Acts like a projectile if (otherCollider2D.CompareTag("Meteor") || otherCollider2D.CompareTag("M_Meteor")) { Meteors meteor = otherCollider2D.gameObject.GetComponent <Meteors>(); meteor.TakeDamage(Damage); gameObject.SetActive(false); } //Player Projectile if (otherCollider2D.tag.Contains("Enemy")) { if (otherCollider2D.CompareTag("EnemyBasic") || otherCollider2D.CompareTag("EnemyBasic_1")) { EnemyShipBasic ship = otherCollider2D.gameObject.GetComponent <EnemyShipBasic>(); ship.TakeDamage(Damage); gameObject.SetActive(false); } if (otherCollider2D.CompareTag("EnemyUFO")) { UFO ufo = otherCollider2D.gameObject.GetComponent <UFO>(); ufo.TakeDamage(Damage); gameObject.SetActive(false); } } //Projectile against projectile if (otherCollider2D.CompareTag("Projectile")) { otherCollider2D.gameObject.SetActive(false); gameObject.SetActive(false); } }