Ejemplo n.º 1
0
    public void TakeDamage(int ammount)
    {
        // Set the damaged flag so the screen will flash.
        damaged = true;

        // Reduce the current health by the damage amount.
        currentHealth -= ammount;
        HealthManager.Decreasehealth(ammount);
        // Set the health bar's value to the current health.
        //healthSlider.value = currentHealth;

        // Play the hurt sound effect.
        //playerAudio.Play();

        // If the player has lost all it's health and the death flag hasn't been set yet...

        if (currentHealth <= 0 && !isDead)
        {
            // ... it should die.
            Death();
        }
    }