In this PR, the framework for our room and level frameworks are introduced, which will allow our designers to create an interconnected web of rooms that can be transitioned between. This will resolve feature #33.
Test
The entire feature can be tested in the scene Scenes/Feature/33-LevelFrameworkTest. The transparent circles are teleporters between rooms.
Note that the system should be error-safe, any potentially crashing errors should be handled by the introduced code. If you catch a crash during testing, do not disregard and be sure to include it in your review.
You can also play around with adding new rooms using the instructions below.
Use
In order to hook up a new room, one must do the following:
Create a new room that the character can play in. The entire room should be parented under a single game object, which should then have a Room.cs component attached. Give the room component a Level-unique ID.
The room needs to be accessible by other rooms. To do so, add in a couple of Transition Endpoints (TEPs) (as children of the room) where the player should be able to enter from and give them room-unique IDs. You will then have to place teleporters in other levels which point to the new room and TEP's IDs.
To make the room exitable, place down teleporters with a valid ID of another room's TEPs.
Note that prefabs for Rooms, TEPs, and Teleporters are included in the prefabs folder.
Note that new rooms do not need to be serialized into the LevelManager, and TEPs do not need to be serialized into their containing room. These scripts are set up to automagically™ find any valid rooms and child TEPs on initialization.
Detail
The framework consists of four functional components- Rooms, Transition Endpoints (TEPs), Teleporters, and the LevelManager.
Rooms: Rooms represent a single playable instance in our game, the player will need to travel through multiple rooms in order to explore the ship. Each one is keyed by a level-unique ID, and also contains a dictionary of all TEPs within it. Only one room can be loaded at once, as the level manager will disable any inactive rooms.
Transition Endpoints: TEPs represent areas within a room where the player can be teleported to in order to enter the level, think of it as the other side of a door. These are keyed by a room-unique ID.
Teleporters: These are given a destination room and TEP ID to try and teleport the player to (Often in a different room, but not necessary).
Level Manager: Acts as a global store of all rooms within the level, as well as providing methods for accessing rooms, endpoints, and triggering transitions between them.
Since our game is set up to treat Rooms as individual game instances, the Level Manager will attempt to only keep exactly one level "Loaded" at a time. For now, "Unloading" a level just involves disabling it's parent GameObject.
Brief
In this PR, the framework for our room and level frameworks are introduced, which will allow our designers to create an interconnected web of rooms that can be transitioned between. This will resolve feature #33.
Test
The entire feature can be tested in the scene
Scenes/Feature/33-LevelFrameworkTest
. The transparent circles are teleporters between rooms.Note that the system should be error-safe, any potentially crashing errors should be handled by the introduced code. If you catch a crash during testing, do not disregard and be sure to include it in your review.
You can also play around with adding new rooms using the instructions below.
Use
In order to hook up a new room, one must do the following:
Room.cs
component attached. Give the room component a Level-unique ID.Note that prefabs for Rooms, TEPs, and Teleporters are included in the prefabs folder.
Note that new rooms do not need to be serialized into the LevelManager, and TEPs do not need to be serialized into their containing room. These scripts are set up to automagically™ find any valid rooms and child TEPs on initialization.
Detail
The framework consists of four functional components- Rooms, Transition Endpoints (TEPs), Teleporters, and the LevelManager.
Since our game is set up to treat Rooms as individual game instances, the Level Manager will attempt to only keep exactly one level "Loaded" at a time. For now, "Unloading" a level just involves disabling it's parent GameObject.