One more thing that's missing now is adding s
into Unity's build in InputManager
. To do that, follow these simple steps.
We have a new input button set up as well as the code executed each time the button is pressed. Time to test that. Press Play in Unity and, after Jake drops on the platform, press S on the keyboard. The StartGame()
method will be called by Unity just after you pressed the key. The StartGame()
method changes currentGameState
to inGame
so our gameplay starts.
So, we completed the first part of the simple gameplay
loop. The user can start the game by pressing the button and the game will start. As we are calling it a loop, it will have to be a closed chain of events. To close the gameplay, we will need to add the GameOver
event.
In our simple game, the game over event will be called when the player dies. There will be two ways to kill the player:
We already have the physics functionality working, which means Jake is falling through the holes. All we need to do is create some sort of trigger telling GameManager
, "Player fallen through the hole, game over!"