예제 #1
0
        public void StartReadingKeys()
        {
            while (true)
            {
                var keyInfo = Console.ReadKey();
                switch (keyInfo.Key)
                {
                case ConsoleKey.LeftArrow: snake.ChangeDirection(Direction.Left); break;

                case ConsoleKey.RightArrow: snake.ChangeDirection(Direction.Right); break;

                case ConsoleKey.UpArrow: snake.ChangeDirection(Direction.Up); break;

                case ConsoleKey.DownArrow: snake.ChangeDirection(Direction.Down); break;
                }
            }
        }