diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-08-24 17:18:52 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-08-24 17:18:52 -0400 |
| commit | d1c6d296e85646853f7aaa5a07e6d5718fce0072 (patch) | |
| tree | 77879b3c7a74c2c5c1a7e08f38a691ce9854aab0 /Assets/Scripts/PauseMenu.cs | |
| parent | 4c8dba7a5ae4338a76e5b8e84438a1bb933e48f6 (diff) | |
| download | Project-Sandbox-d1c6d296e85646853f7aaa5a07e6d5718fce0072.tar.gz Project-Sandbox-d1c6d296e85646853f7aaa5a07e6d5718fce0072.tar.bz2 Project-Sandbox-d1c6d296e85646853f7aaa5a07e6d5718fce0072.zip | |
Pause menu; Dialogue; New font
Diffstat (limited to 'Assets/Scripts/PauseMenu.cs')
| -rw-r--r-- | Assets/Scripts/PauseMenu.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Assets/Scripts/PauseMenu.cs b/Assets/Scripts/PauseMenu.cs new file mode 100644 index 0000000..284756f --- /dev/null +++ b/Assets/Scripts/PauseMenu.cs @@ -0,0 +1,38 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class PauseMenu : MonoBehaviour
+{
+ public bool lockCursor = true;
+
+ public GameObject panel;
+ private int counter;
+ // Update is called once per frame
+ public void showhidePanel()
+ {
+ counter++;
+ if (counter % 2 == 1)
+ {
+ panel.gameObject.SetActive(true);
+ }
+ else
+ {
+ panel.gameObject.SetActive(false);
+ }
+
+ }
+ void Update()
+ {
+ if (Input.GetKeyDown(KeyCode.Escape))
+ {
+ lockCursor = !lockCursor;
+ showhidePanel();
+
+ }
+
+ Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None;
+ Cursor.visible = !lockCursor;
+ }
+}
|
