Пример #1
0
        static void Main(string[] args)
        {
            GameState game = new GameState();

            player.SetName();
            game.Run();
            while (true)
            {
                player.Draw();
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                if (consoleKeyInfo.Key == ConsoleKey.F2)
                {
                    Serialize(game);
                }
                else if (consoleKeyInfo.Key == ConsoleKey.F3)
                {
                    game.Stop();
                    game = Deserialize();
                    game.Run();
                }
                else
                {
                    game.ProcessKeyEvent(consoleKeyInfo);
                }
            }
        }
Пример #2
0
 public GameState()
 {
     Console.SetWindowSize(40, 42);
     Console.SetBufferSize(40, 42);
     Console.CursorVisible = false;
     player.SetName();
 }