top of page
Resource Management

What would a resource management game be without its resource management? In my opinion those are the most important scripts that i created for the game.

This First one is Called ShipHealth and it controls the health, air and energy resources on the ship. It also displays them on the players inventory an on the main screen in the cockpit.

ShipHealth1.PNG
ShipHealth2.PNG

The script uses the ui components of unity to display the resources.

It takes input using the static variables air , health to manage those resources also it automatically drains the energy resource, this being the only one that the player can not get back.

The air resource has attached a timer to it that will slowly fill it up, this can get easily overwhelmed by the amount hat is drained when there are multiple cracks present, it is the same for the energy drain.

Also the air resource has a maximum of 100 units and the script will not allow it to go over that amount.

If any of the three resources would get depleted the script will run the dead function which will stop time and present the player with an in-world ui that will take him to the menu.

Ded.PNG

Another important script is the crack fixer. It is a script that is attached to the cracks that spawn randomly, it represents the input that the air and health resources that i talked about earlier get.

This ui has a script attached to it that once pressed will reset all the static variables and also take the player back to the menu. This script is used in multiple parts of the game.

DeadButton.PNG
CrackFixer1.PNG
CrackFixer2.PNG

The script contains a timer that when it resets it consumes a certain amount of resources. The cracks have two stages, the first stage takes both air and health and has a particle system attached to it to represent the air flow and the second one disables the particle system, also only takes away health from the resources. To interact with this the player needs to use one of the tools, the weld tool to be more precise.

If you recall what i said earlier the "disasters", holes are spawned randomly around the ship, to do this i have created the script that you will find below.

HoleSpawner.PNG

It is quite a simple script that has an array of locations and a timer. When the timer resets it will choose a random location from the array and it will use the instantiate function to create the crack at the position and the rotation of that location.

One thing that i would have done differently if i had time, i would have made it check whether or not there is already a crack at that location and if it was it would not instantiate it and it would instantiate at another location.

bottom of page