Ejemplo n.º 1
0
    // Applies damage to the player and eventually manages its death.
    public override void TakeDamage(int damage, int killerID)
    {
        if (inGame)
        {
            health -= damage;

            // If the health goes under 0, kill the entity and start the respawn process.
            if (health <= 0f)
            {
                health = 0;
                // Kill the entity.
                Die(killerID);
            }

            playerUIManagerScript.SetHealth(health, totalHealth);
            playerUIManagerScript.ShowDamage();
        }
    }