I’ve got the basic logic down, but I’m having trouble implementing it. My idea is that each room/piece has up to 4 spawn points attached to it that indicate where a opening or connector to another room is. Depending on the direction, they’re labelled 1-4 for North, South, etc.
I have a box collider attached at the actual openings of the models to check if it’s already touching another room, which would mark the opening as being inaccessible and not spawning another room.
extra reference screenshots
much appreciated in advance!
You set isAccessible = false
at the end of your while-loop. But the condition for it to continue looping is isAccessible == true
. So only one room will spawn.,You write is Accessible = false;
and the statement of your while loop checks if isAccessible
is true. You get just one loop and then it stops, so only one room will spawn.
You write isAccessible = false
and the statement of your while loop checks if isAccessible
is true. You get just one loop and then it stops, so only one room will spawn.
I found a fix for the issue. My rooms being spawned were being set to an IF statement that essentially never became true due to the setup of my world. Changing the IF statement to a WHILE loop bound to a variable that counted down each loop fixed it - even though I found even more issues later, it fixed the problem.