Choose Next Room
This function is the main part of the procedural generation: it's where you set your own logic to generate your dungeon.
This function is run each time the generator tries to add a room to the dungeon.
As input parameters:
Current Roomis the room from which the generator will try to add the next room.
For example, the first time this function is called, theCurrent Roomis theRoomDataasset you have returned in theChoose First Roomfunction.Door Datais the door on which the next room will be connected to.
You have access to its location (expressed in room units, not in unreal units!), its orientation and itsDoorType.
As output:
Return Valueis theRoom Dataasset you want to add as the next room. The value must be non-null and have at least one compatible door withDoor Data.Door Indexis the index of the door (from theRoom Dataasset your return) used to connect with theCurrent Room.
If the index is negative, it will choose a random compatible door.
If you set a value, it will take the door at the same index in yourRoom Dataasset (make sure the door is compatible!)
Here an example of a simple dungeon made by NbRoom randomly chosen standard rooms before setting an exit room:

How can I do it?
If you struggle to write the code in this function, I would suggest you to read this page to better understand the workflow to write the code in this function.