Important notes about the visual showcases:
Left gif: I made the monitor show the camera's perspective and update at a set framerate.
Top right gif: I made the closing and opening eyes effect.
Bottom right gif: I made the player replenish oxygen when nearby an ore.
This section goes more in depth about how everything works, reasons why we did what we did and also shows some code.
When I first made the game manager the game idea hadn't been fully developed yet. Therefore I started out making just a simple pause and resume function. I went back to it later on to add functionality for when the player dies and a way to restart the scene.
The pause and unpause functions.
A function for locking the player's movement for a set duration.
Some extra functions that were also added to the game manager. The PlayerDied() function handles the respawning of the player together with the RestartScene() function.
The way respawning was handled in our game changed a bit over time. Early on we simply teleported the player back and reset some of the stats. Then, we refactored it to reload the scene completely instead. Eventually we ended up on the final iteration which was reverting it back to the old teleporting system, to have control of what gets reset.
This was part of the respawning, after you reach 0 oxygen your screen keeps getting darker until you drown when it's completely dark. If you get oxygen back before the screen goes completely black you'd stop drowning.
This would make the screen go back to normal over a period of time if you regain oxygen.
The function in the game manager to handle the respawning of the player.
The function for resetting the player back to the boat again.
I was asked to make the resources give off oxygen if the player was within its proximity.
The way I decided to do this was through the use of a collider set as a trigger. When the player entered the collider, I set a bool to true which would continously give the player oxygen. When the player left the collider I set the bool to false to stop the oxygen from ticking up.
In the game, the designers wanted the player to feel like they were being watched by the company the player works for. I suggested a surveillance camera and a monitor showing what the camera sees and we agreed on it. I placed a camera in the scene that renders whatever it sees to a render texture. Using this render texture I made a material I could apply on the screen, to make the screen continuously show what the camera sees. I later refactored it to all happen through code because we wanted the screen to update less often.
This feature did cause some lag in the game though and in retrospect I believe I know how I'd fix it. I didn't make any logic to check when the camera should be active, which meant it was active all the time even when the player couldn't see the screen. If I was to revisit this again or make something similar in the future, I'd at the very least make sure it doesn't render when it's not visible on the player's screen.
As long as the player was within a certain distance of the camera, the camera would update the texture on the monitor.
This was for the [Rec] icon updating on the monitor. I did notice just now how this was done in the update function which is way more frequent than required. I think it would be better to do it in fixed update for performance.
I made some different ways to fade the screen in and out. I made a normal fade in / out and then a blink effect, which made it look like the character was actually closing and opening its eyes. I made these entirely through code but they were later refactored to be animations. That wasn't done by me though so I will show the earlier iteration.
(1/2)
(2/2) This was the function for the blinking effect, it was a lot of manual work but it was fun to do. Definitely not the best solution. There were other functions to do the opening and closing separately as well.
The fade function.
The unfade function. I know it's called fade out, I don't know why I called it unfade.
Because it would be annoying for the player to keep grabbing the gear in each new level, I was asked to make the player auto equip gear after the first time it had been equipped.
As long as this object was added to the scene, the player would auto equip the gear on start.
I worked on other things as well such as refactoring the oxygen to use the player's enum statemachine instead, creating and implementing some VFX and handling the playing of some of the animations in the game. The effects I created was the camera shake when drilling and the button flashing red when you've met your quota. These are not super relevant to my role as a programmer though which is why I'm choosing to leave them out.
As for my thoughts on this project, I think I did pretty well. I definitely used coroutines way too much as I had just discovered them. I hadn't realized the pros and cons with them yet.
In this project I learnt a lot. I learnt how I could use render textures and cameras to make the CCTV system, but also how expensive that is for the game, having more than one camera rendering. I now understand that it's important to really optimise the usage of the camera. I also got a better understanding of why realtime feedback in the game is so important for the users. This project is where I got introduced to singletons as well, which has been an important programming pattern I've implemented in other projects as well.