Transmutation takes place 5 levels underground in a nuclear plant canteen. Three overnight staff are having their lunch break when something goes wrong. They need to leave the plant and the only way out – is up.
The way to win transmutation is to survive for a total of 4 minutes and enter the elevator to escape. When the game has been running for a 4 minutes the elevator doors will open allowing the remaining playable characters to enter and activate a game over screen.
What the elevator will require:
- A 4 minute timer.
- A current timer.
- A way to tell the doors they can open.
- A way to trigger the game over screen.
What the elevator doors will require:
- A way to know they can open.
- Positions to open to.
The current timer can increase with game time: In Update() timer += Time.DeltaTime. Then if the timer is greater than the set time for the game duration, tell the doors they can open.
Each of the elevator doors have their own script. The sole purpose of that script is to know when to open, and move itself to the open position. When the elevator has arrived to 5th floor it will change its hasArrived bool to true. Each of the elevator doors are waiting for the elevator to arrive and when it does move to the open position.
Each elevator door has its own openPosition Vector3 variable. They’re in world position co-ordinates because I had great difficulty working with transform.localPosition (as they are a child of the elevator).
Now that the elevator doors open it was time for a way to trigger a game over menu. The elevator would need access to the UIController to activate the game over menu and a way to activate the game over menu. For now, a simple OnTriggerEnter with a playable character would suffice.
Until next time –