示例#1
0
    public void BiteTheCake(int damage)
    {
        bool IsCakeAllEaten = playerHealth.ApplyDamage(damage);

        if (IsCakeAllEaten)
        {
            GameOver(false);
        }

        OneMorePandaInHeaven();
    }
    //Function that damages the player when a Panda reaches the player's cake.
    //Moreover, it monitors the player's health to trigger the GameOver function when needed
    public void BiteTheCake(int damage)
    {
        //Apply damage to the player and retrive a boolean to see if the cake has been eaten all
        bool IsCakeAllEaten = playerHealth.ApplyDamage(damage);

        //If the cake has been eaten all, the GameOver function is called in "losing mode"
        if (IsCakeAllEaten)
        {
            GameOver(false);
        }
        //The Panda that bit the cake will also explode, and therefore we have a Panda less to defeat
        OneMorePandaInHeaven();
    }