예제 #1
0
        private static void DisplayGame()
        {
            // Display the map.
            for (int y = 0; y < _map.Height; ++y)
            {
                for (int x = 0; x < _map.Width; ++x)
                {
                    Tile tile = _map.Tiles[x, y];
                    switch (tile)
                    {
                    case Tile.HorizontalWall:
                        ConsoleScreen.Write(x, y, '-');
                        break;

                    case Tile.VerticalWall:
                        ConsoleScreen.Write(x, y, '|');
                        break;

                    case Tile.Door:
                        ConsoleScreen.Write(x, y, '+', ConsoleColor.Green, ConsoleColor.Black);
                        break;

                    case Tile.Floor:
                    default:
                        ConsoleScreen.Write(x, y, ' ');
                        break;
                    }
                }
            }

            // Display the player.
            ConsoleScreen.Write(_player.X, _player.Y, '@', ConsoleColor.DarkCyan, ConsoleColor.Black);

            // Display the enemies.
            foreach (Enemy enemy in _map.Enemies)
            {
                ConsoleScreen.Write(enemy.X, enemy.Y, 'e', ConsoleColor.Red, ConsoleColor.Black);
            }

            // Draw to the console screen.
            ConsoleScreen.Draw();
        }