public void KeyPressed(ConsoleKeyInfo pressedKey) { switch (pressedKey.Key) { case ConsoleKey.UpArrow: _worm.ChangeDirection(0, -1); break; case ConsoleKey.DownArrow: _worm.ChangeDirection(0, 1); break; case ConsoleKey.LeftArrow: _worm.ChangeDirection(-1, 0); break; case ConsoleKey.RightArrow: _worm.ChangeDirection(1, 0); break; case ConsoleKey.S: _worm.Save("save"); _wall.Save("wall"); break; case ConsoleKey.L: Console.Clear(); _wormTimer.Stop(); _wall.Clear(); _worm.Clear(); _food.Clear(); _wall = Wall.Load("wall"); _worm = Worm.Load("save"); _food = new Food('$', ConsoleColor.Red); if (_worm.CountOfPoints >= 3) { _wall.NextLevel(); } else { _wall.LoadLevel(); } _wormTimer.Start(); break; case ConsoleKey.Spacebar: if (!_pause) { _wormTimer.Stop(); _pause = true; } else { _wormTimer.Start(); _pause = false; } break; case ConsoleKey.Escape: Console.Clear(); Console.SetCursorPosition(15, 20); Console.WriteLine("Good Bye"); IsRunning = false; break; } }