Capstone: Month 2 Week 2
This post covers the 6th week of our Capstone project.
This Week’s Tasks
This week I was tasked with:
- Scene Controller System
- Grenade Launcher
- Jetpack
For the purposes of this post, I will be focusing on the Scene Management System.
Scene Controller System
So far, the Scene Controller is fairly simple. It’s main job is to load the requested scene, and place the player at the correct point in the scene. Because the PlayerController uses the CharacterController unity component, it’s a bit more complicated than just setting the position. Because of the physics calculations, you have to disable this component, set both the transform position and the character controller position, and then re-enable the component. The Scene Controller is implemented using the Singleton pattern, so there is only one instance of it in the scene.
Another major factor that was done in parallel with the Scene Controller, is making the game & player state persistent. Previously, every scene just had its own player controller and game systems. Now, many of these systems have been made to follow the singleton pattern, and only one is allowed to exist at a time. This means that the game systems and the player controller are actually brought to each scene, and the state is persisted.