Overview of Level Exit Gates
Within each LocalMap there will be a requirement which needs to be met before players can leave the LocalMap.
The LevelExitGate they choose to take could also dictate which LocalMap they move to next.
From initial brainstorming we came up with three methods by which the Players will need to unlock the LevelExitGate.
Solving a Puzzle
EG: Activate an autonomous machine by hacking into it and instructing it to move the obstacle out of the way
Collecting a minimum amount of a UniqueResource
EG: dynamite to blast aside fallen rocks
Paying a ResourceTax for a minimum amount of a regular Resource
EG: Metal to repair a system responsible for opening a gate across a tunnel
Mechanically the way the LevelExitGate would work is as a script within the LocalMap scene. The script would have states to switch between - Locked and Unlocked, with an event listener on the script which would call a method to switch between the states. When in the Unlocked state the Level Exit Gate would simply remove a game object acting as a barrier and allow the Train object to move into a trigger which causes the Players to exit the Local Map.
When each Local Map is generated, part of the process would be instantiating in a LevelExitManager which would randomly select the type of requirement for unlocking the LevelExitGate and instantiate the relevant prefabs.
For example the LevelExitManager could select Puzzle. It would instantiate:
PuzzleManager
PuzzleStation_A, _B and _C
GridGenerator
PuzzleCamera_A, _B and _C
And these prefabs would in turn instantiate everything required for the Puzzle.
The type of requirement would not matter for the LevelExitGate mechanically, as it would simply contain a listener which would dictate when it switches to Unlocked. In the Puzzle example the PuzzleManaer script would send out the UnlockGate event once the requirements for the puzzle were met, which would cause the LevelExitGate to switch to Unlocked. If it were a UniqueResource requirement there would be a UniqueResourceManager script which would send out the same UnlockGate event, and likewise for ResourceTax with a ResourceTaxManager.
Currently only the Puzzle system is fully outlined in this GDD, but the LevelExitGate would be set up in such a way that any number of types of requirements could be set up as valid ways to unlock the exit to a LocalMap since they would only need to send out the UnlockGate event.
For narrative purposes the LevelExitGate object itself (and any animations which occur when it switches state) would probably need to adapt based on the type of requirement selected. It wouldn't make much sense in-universe if the requirement for exiting was a UniqueResource and was specified to be 'dynamite for blowing up the boulder blocking the way' but visually simply showed a gate opening.