Start():
This Gets the Character Controller component on start up that has been attached to the script
Update():
When the Pause button/Key has been pressed (In this instance P is the pause button at this time) the program checks if the gameIsPaused bool is either true or false, if false the game will be paused when the pause key is pressed, freezing the game speed to zero, disabling the camera movement, and disabling the character controller so the player character cannot move while game is paused.
If the pause key is pressed again while either the pause screen is active or options pause screen is active, both windows will be closed, setting the gameIsPaused bool to false which will then set the game time scale back to 1 and enable both the camera and character controller so the player can move the player character once again
QuitGame():
This when activated will send the user back to the start screen instead of quitting the application as a whole by loading scene 0 which is the start screen
Comments
Post a Comment