Ejemplo n.º 1
0
        private static void ProcessInput(Game game, ConsoleKey key)
        {
            switch (key)
            {
            // Directions
            case ConsoleKey.DownArrow:
                game.CurrentPosition += new Size(0, 1);
                break;

            case ConsoleKey.UpArrow:
                game.CurrentPosition -= new Size(0, 1);
                break;

            case ConsoleKey.LeftArrow:
                game.CurrentPosition -= new Size(1, 0);
                break;

            case ConsoleKey.RightArrow:
                game.CurrentPosition += new Size(1, 0);
                break;

            // Flip Tile
            case ConsoleKey.Spacebar:
                game.FlipTile();
                break;

            // Flag Tile
            case ConsoleKey.F:
                game.FlagTile();
                break;

            // Reset Board
            case ConsoleKey.R:
                game.Start();
                break;

            // Quit Game
            case ConsoleKey.Q:
                Console.Clear();
                Console.WriteLine("Thanks For Playing!");
                game.Status = Status.Quit;
                break;

            default:
                Console.WriteLine("Unknown Key");
                break;
            }
        }