An integral part of Lament is the boss fight at the end of every dungeon, whether it be in terms of gameplay or narrative.
The logic to spawn the gateway to the boss room was written to spawn in the last instantiated room in the dungeon (The furthest room from the entry room in the dungeon scene). In the Room Templates script in the Update() method, it checks if the timer waitTime float is over until it can check how many rooms have been instantiated. As the .Count function starts with 0, the boss gateway is spawned in the (rooms.Count – 1)th room.

Boss Gateway Spawner

Now that the logic for the boss gateway spawner, I needed to put in place a system that would spawn the actual boss gate if the room was cleared. However, this was simple to do as the RoomManager gameobejct/script did basically the same thing. The RoomManager script would count how many enemies were in a room, and then removed the doors blocking the room if they had all been defeated. A more detailed explanation on the RoomManager gameobject and script are in the Procedural Room Generation Development Post.
I repurposed this for the Boss Gateway spawner, keeping the BoxCollider2D component to count the enemies and the enemies list to keep track of the number of enemies. However, instead of removing the doors, it would spawn the Boss Gateway prefab.

Boss Gateway
