Beispiel #1
0
 public void Collide(Game game)
 {
     Representation            = new RoomTile().Representation;
     color                     = new RoomTile().color;
     PairedDoor.IsAccessible   = true;
     PairedDoor.Representation = ' ';
 }
Beispiel #2
0
        public void Generate(Room previousRoom)
        {
            this.Map = new Tile[mapWidth, mapHeight];
            int playerX = game.Player.PosX;
            int playerY = game.Player.PosY;

            for (int row = 0; row < this.mapWidth; row++)
            {
                for (int column = 0; column < mapHeight; column++)
                {
                    // When player enters new room, add a ReturnDoorTile at their position
                    if (row == playerX && column == playerY && previousRoom != null)
                    {
                        Map[row, column] = new ReturnDoorTile(previousRoom);
                    }
                    else if (row == 0 || column == 0 || row == mapWidth - 1 || column == mapHeight - 1)
                    {
                        if ((row == 0 && column == 0) ||
                            (row == 0 && column == mapHeight - 1) ||
                            (row == mapWidth - 1 && column == 0) ||
                            (row == mapWidth - 1 && column == mapHeight - 1))
                        {
                            Map[row, column] = new CornerTile();
                        }
                        else
                        {
                            Map[row, column] = new WallTile();
                        }
                    }
                    else
                    {
                        Map[row, column] = new RoomTile();
                    }
                }
            }

            int numberOfTraps    = new Random().Next(3, game.MapHeight);
            int numberOfMonsters = new Random().Next(3, game.MapWidth);

            PlaceKeyDoorPair(new DoorTile(game, ConsoleColor.Red));
            PlaceKeyDoorPair(new DoorTile(game, ConsoleColor.Blue));
            PlaceButtonTrapPairs(numberOfTraps);
            PlaceMonsters(numberOfMonsters);
        }