Esempio n. 1
0
    public void TakeDamage(int damage)
    {
        // Exit if player is invincible.
        if (invincible)
        {
            return;
        }

        /**
         *  Player gets tougher when low in health.
         */
        healthBar.value -= AdjustDamage(damage);

        timer        = 0f;
        regenerating = false;

        /**
         *  Display HP bar.
         */
        FadeInOut(true);

        /**
         *  Play player hurt voice.
         */
        playerSFX.PlayerHurtVoice(0.1f);

        /**
         *  Flash the screen opaque red.
         */
        VFX.HurtFlash();
    }