static void GameProcess(Game a) { Console.Clear(); ConsoleKeyInfo btn = new ConsoleKeyInfo(); int level = 1; a.ShowHeader(); while (btn.Key != ConsoleKey.Escape) { if (level > a.level) { a.level++; a.wall.ReadLevel(level); Console.SetCursorPosition(7, 0); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(level + " "); } a.snake.Draw(); a.food.Draw(); a.wall.Draw(); btn = Console.ReadKey(); if (btn.Key == ConsoleKey.UpArrow) { a.snake.Move(0, -1); } if (btn.Key == ConsoleKey.DownArrow) { a.snake.Move(0, 1); } if (btn.Key == ConsoleKey.LeftArrow) { a.snake.Move(-1, 0); } if (btn.Key == ConsoleKey.RightArrow) { a.snake.Move(1, 0); } a.snake.Eat(a.food, a.wall, a.snake); if (a.snake.Collision(a.wall)) { a = new Game(); a.GameOver(); break; } if (a.snake.body.Count > a.wall.score) { level++; } } game = a; SaveDataGame(game, false); }