PlayerHealth.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        // If health is less than or equal to 0...
        if (_health <= 0f)
        {

            // Otherwise, if the player is dead, call the PlayerDead and LevelReset functions.
            PlayerDead();
            LevelReset();
        }
    }

Usage Example

Example #1
0
 // Update is called once per frame
 void Update()
 {
     health.Update();
     if (health.Dead())
     {
         playerAlive = false;
         deathReason = "You got mauled by a zombie!";
     }
 }
All Usage Examples Of PlayerHealth::Update