Exemple #1
0
        private static void GetUserInput()
        {
            ConsoleKeyInfo userInput;

            while (Board.Cookies > 0)
            {
                userInput = Console.ReadKey();
                if (userInput.Key == ConsoleKey.UpArrow)
                {
                    Pacman.ChangePacmanDirection((Direction)userInput.Key);
                }
                else if (userInput.Key == ConsoleKey.RightArrow)
                {
                    Pacman.ChangePacmanDirection((Direction)userInput.Key);
                }
                else if (userInput.Key == ConsoleKey.DownArrow)
                {
                    Pacman.ChangePacmanDirection((Direction)userInput.Key);
                }
                else if (userInput.Key == ConsoleKey.LeftArrow)
                {
                    Pacman.ChangePacmanDirection((Direction)userInput.Key);
                }
            }
        }