I could simply look at the width and height values to find this information. This allowed for a few things… Primarily, it meant that I didn’t have to actually test around the tiles with physics to see if any given tile was an edge tile.
I chose, however, to use a simple “nested for loop” to build the x & y coordinates instead: I could still continue building the rooms using total area, or total number of square tiles, and then, using the width of the room, build the room by rows using one line of code. If the new room collided with anything, then I would recycle the room. The something new was to build the new room at origin, then move it into the new proposed location and test the location using collision detection. The next step was to change my approach from finding the exit to the last built room, adding a door, then trying to build a new room at that location, to something new. Popping into Photoshop, I whipped up some very very basic textures. The door, I placed as a child in the middle of a floor tile. I made a floor quad and a door, both with their own box collider. So – I created some very basic shapes for testing. I would like to return to them once the system is working, but for now, I needed some very simple building blocks to test with. They were unique enough that I found myself hampered by their details. The first thing I did was throw out the BigGem assets, as much as I loved them. So I stopped the blind frontal assault, sat down and rethought my whole approach. If I was going to build the room from a start point, I would also need to affect the orientation of the room before we built it. More often than not, the room was simply building over the room it came from. This worked well, though this pattern was aligned to the world coordinates.
The code that created the rooms created them by rows from the start point. When we left off with this saga I had roughly generated random room sizes and found random start points for new rooms. The door units are cobbled together starting with a floor tile and a slab to represent a door, with some wall units attached which simply and inelegantly overlap the walls nearest to it. The entire system is based on 1 meter square floor tiles along with wall panels at and door tiles with a foot print of 1 unit square.