Skip to content
Snippets Groups Projects
Commit bdeebdf5 authored by WJohnM18's avatar WJohnM18
Browse files

Add pause function to LivingRoomDemo

parent 7f82672b
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -12,11 +12,32 @@ public class CameraFlyer : MonoBehaviour { ...@@ -12,11 +12,32 @@ public class CameraFlyer : MonoBehaviour {
public bool invertAxisY = true; public bool invertAxisY = true;
public GameObject pauseScreen;
public KeyCode pauseButton = KeyCode.Space;
private float yaw = 0.0f; private float yaw = 0.0f;
private float pitch = 0.0f; private float pitch = 0.0f;
// Update is called once per frame private bool gamePaused;
void Update () { void Update () {
if (Input.GetKeyDown(pauseButton)) {
gamePaused = !gamePaused;
}
if (!gamePaused) {
pauseScreen.SetActive(false);
moveCamera();
} else {
pauseScreen.SetActive(true);
}
}
private void moveCamera() {
float lookHorizontal = lookSpeedHorizontal * Input.GetAxis("Mouse X"); float lookHorizontal = lookSpeedHorizontal * Input.GetAxis("Mouse X");
float lookVertical = lookSpeedVertical * Input.GetAxis("Mouse Y"); float lookVertical = lookSpeedVertical * Input.GetAxis("Mouse Y");
......
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -106,3 +106,11 @@ Cmd: initializeCompiler ...@@ -106,3 +106,11 @@ Cmd: initializeCompiler
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
Cmd: initializeCompiler
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment