//public methods public Room GenerateRoom(int level, int difficulty, List <Piece> pieceSet) { Room toReturn = new Room(1, "test name"); //Generate a new room based on the given level and difficulty // First create the outline of the room - this will be some number of slots in some shape // determine the number of slots by the current level and difficulty int numSlots = GetNumSlots(level, difficulty); //Create the slots roomSlots = new Slot[numSlots, numSlots]; for (int x = 0; x < numSlots; x++) { for (int y = 0; y < numSlots; y++) { roomSlots[x, y] = new Slot(new Vector2Int(x, y), pieceSet); } } // determine which slots will be "active" and which will be "inactive" DetermineSlotActivity(numSlots); //Next we collapse the active slots following the WFC algo WaveFunctionCollapse.SetSlots(ref roomSlots, pieceSet); while (!WaveFunctionCollapse.IsCollapsed()) { WaveFunctionCollapse.Iterate(); } //The wave function is complete and our room is ready //Add the active slots with prefabs instantiated into the room AddCollapsedSlotsToRoom(ref toReturn); return(toReturn); }