public void Damage(int p) { if (!isInvincible) { hp -= p; if (hp <= 0) { if (!roomIndependent) { room.getActiveRoom().GetComponent <DoorManager>().killEnemy(); } if (endGame) { StartCoroutine(GameOver()); } else { Instantiate(soul, transform.position, transform.rotation); Destroy(gameObject); } } } }