示例#1
0
    bool CheckIfGameOver()
    {
        if (_timeLeft < 0)
        {
            // Set timeout text
            _gameOverTxt = "Time Expired :(";
            _resultTxt   = string.Format("Total Moves {0}", _moves);
            effectsManager.PlayEndSound();

            return(true);
        }

        // All the disks are stacked in the winning stick
        if (winningStick.DiskCount() == disks.Length)
        {
            // Set winning text
            _gameOverTxt = "Congratulations :)";
            _resultTxt   = string.Format("Time {0}{1}Total Moves {2}", GetFormattedTime(gameTime - _timeLeft), Environment.NewLine, _moves);
            effectsManager.PlayWinningSounds();

            return(true);
        }

        return(false);
    }