Ejemplo n.º 1
0
    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);
                }
            }
        }
    }