public void OnKeyPress(ConsoleKey key)
        {
            if (key == ConsoleKey.Enter)
            {
                Done = true;
                return;
            }

            if (key == ConsoleKey.LeftArrow)
            {
                if (currentSnakeIndex == 0)
                {
                    currentSnakeIndex = snakes.Length - 1;
                }
                else
                {
                    currentSnakeIndex--;
                }
            }
            else if (key == ConsoleKey.RightArrow)
            {
                if (currentSnakeIndex == snakes.Length - 1)
                {
                    currentSnakeIndex = 0;
                }
                else
                {
                    currentSnakeIndex++;
                }
            }

            OutputWriter.DisplayMenu(this);
        }
Example #2
0
        private void Pause()
        {
            PauseMenu pauseMenu = new PauseMenu();

            OutputWriter.DisplayMenu(pauseMenu);
        }