private static void GameOver() { string gameOver = "GAME OVER!"; string printPoint = string.Format("You won {0} points.", points); PrintAtPosition(columns / 2 - gameOver.Length / 2, rows / 2, gameOver, ConsoleColor.Black, ConsoleColor.Yellow); PrintAtPosition(columns / 2 - printPoint.Length / 2, rows / 2 + 1, printPoint, ConsoleColor.Black, ConsoleColor.Yellow); // Initialize a new instance of the SpeechSynthesizer. SpeechSynthesizer synth = new SpeechSynthesizer(); // Configure the audio output. synth.SetOutputToDefaultAudioDevice(); // Speak a string. synth.Speak(string.Format("Game Over! You won {0} points.", points)); Thread.Sleep(1000); HighScores score = new HighScores(); if (score.CheckHighScore(points)) { string highScore = "You make a highscore!"; PrintAtPosition(columns / 2 - highScore.Length / 2, rows / 2 + 2, highScore, ConsoleColor.White, ConsoleColor.DarkMagenta); score.AddScore(points, Start.NickName); synth.Speak("You make a highscore!"); Console.BackgroundColor = ConsoleColor.Black; Thread.Sleep(2000); Start.EffectsWithPrinting(); HighScores myScore = new HighScores(); myScore.ShowHighScore(); Menu.ExitSelection(); } Console.BackgroundColor = ConsoleColor.Black; points = 0; }
private static void DrawGameFinish() { string message = string.Format("Congratulations! You completed The GAME !"); PrintAtPosition(columns / 2 - message.Length / 2, rows / 2, message, ConsoleColor.Yellow, ConsoleColor.Black); // Initialize a new instance of the SpeechSynthesizer. SpeechSynthesizer synth = new SpeechSynthesizer(); // Configure the audio output. synth.SetOutputToDefaultAudioDevice(); // Speak a string. synth.Speak(string.Format("Congratulations! You completed The GAME !")); Thread.Sleep(1000); HighScores score = new HighScores(); if (score.CheckHighScore(points)) { string highScore = "You make a highscore!"; PrintAtPosition(columns / 2 - highScore.Length / 2, rows / 2 + 1, highScore, ConsoleColor.White, ConsoleColor.DarkMagenta); score.AddScore(points, Start.NickName); synth.Speak("You make a highscore!"); Console.BackgroundColor = ConsoleColor.Black; Thread.Sleep(2000); Start.EffectsWithPrinting(); HighScores myScore = new HighScores(); myScore.ShowHighScore(); Menu.ExitSelection(); } Console.BackgroundColor = ConsoleColor.Black; points = 0; }