예제 #1
0
        /// <summary>
        /// Uses the UI to display the player's death and observes if the
        /// player is in the top 10 scores, prompting him to input his name
        /// if necessary.
        /// </summary>
        private void EndGame()
        {
            UI.WriteMessage("You died.");

            if (highscoreTable.IsHighscore(gameValues.Level))
            {
                //Prompts player to type their username
                string username = UI.PromptUsername();
                //Adds score to highscoreTable
                highscoreTable.AddScore(username, gameValues.Level);
                //Save changes
                SaveManager.Save(highscoreTable);
            }

            //Reset values
            gameValues.Level = 0;
            gameValues.Hp    = (gameValues.Height * gameValues.Width) / 4;
        }