private void OnCollisionEnter2D(Collision2D other) { RPGPlayer player = other.gameObject.GetComponent <RPGPlayer>(); Projectile proj = other.gameObject.GetComponent <Projectile>(); Sword sword = other.gameObject.GetComponent <Sword>(); if (player != null) { player.Injure(EnemyDamage); } else if (proj != null) { // Injury from Projectile Injure(proj.Damage); // Remove the Projectile proj.Disable(); } //Collided with Sword else if (sword != null) { Injure(sword.Damage); } }