Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Snake Defender");
            Console.WriteLine("Press 'Enter' for start");
            ConsoleKeyInfo keyInfo = Console.ReadKey();

            if (keyInfo.Key == ConsoleKey.Enter)
            {
                do
                {
                    var game = new ConsoleGame(_gameSettings, _randomGenerator);
                    _resultsAnalysis.RaiseMyEvent += game.ShowResults;
                    game.StartGame();
                    // when Game Over
                    GameCompleted(game);
                    Console.WriteLine("Press 'Enter' for restart");
                    keyInfo = Console.ReadKey();
                    Console.Clear();
                } while (keyInfo.Key == ConsoleKey.Enter);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var resultsAnalysis = new ResultsProcessing();

            Console.WriteLine("Snake Defender");
            Console.WriteLine("Press 'Enter' for start");
            ConsoleKeyInfo key_info = Console.ReadKey();

            if (key_info.Key == ConsoleKey.Enter)
            {
                while (key_info.Key == ConsoleKey.Enter)
                {
                    var game = new ConsoleGame();
                    game.StartGame();
                    // when Game Over
                    Console.WriteLine("Your score --> {0}", game.Score);
                    resultsAnalysis.CheckResult(game.Score);
                    resultsAnalysis.ShowResults();
                    Console.WriteLine("Press 'Enter' for restart");
                    key_info = Console.ReadKey();
                    Console.Clear();
                }
            }
        }