Exemple #1
0
    public void takeDamage(int damage)
    {
        //remove the amount of health specified
        currentHealth = currentHealth - damage;
        //if health is less than or equal to 0 call the die function
        if (currentHealth <= 0)
        {
            die();
        }

        //make the character red to indicate that damage has been taken
        amIRed           = true;
        myRenderer.color = myRed;
        countdownTimer   = timeSpentRed;
        if (myHealthDisplay.enabled)
        {
            myHealthDisplay.RedisplayCorrectHealth();
        }
    }