} //Constructor public override MapGenerator.MapData Generate(MapGenerator.RoomsDataCollection rooms, int mapWidth, int mapHeight) { // Make sure there is rooms and map data, if not then ... exit. if (rooms == null || rooms.Count == 0 || mapWidth <= 0 || mapHeight <= 0) { return(null); } // Clear and resize the map. MapGenerator.MapData results = new MapGenerator.MapData(mapWidth, mapHeight); // Create the instance to the randomizer. MapHelpers.SetRandomSeed(this.Options.Seed); // (Step 1) Fill the map with random matching tiles. FillWithRandomTiles(results, rooms, this.Options.IgnoreBoundries, this.Options.SubsetID, this.Options.IncludeRooms, this.Options.IncludePassages, this.Options.Pattern); // (Step 2) Decide what to do with the unconnected tiles ... if (this.Options.UnconnectedTilesAction == UnconnectedTilesActions.ConnectAll) { // ... Connect all unconnected tiles. MapHelpers.ConnectPathsets(results, rooms, this.Options.IgnoreBoundries, this.Options.SubsetID); } else if (this.Options.UnconnectedTilesAction == UnconnectedTilesActions.RemoveSmallerSets) { // ... Remove all unconnected tiles. MapHelpers.RemoveAllSmallPathSets(results); } // Remove the map data. return(results); } //Generate