summaryrefslogtreecommitdiff
path: root/Assets/Scripts/PauseMenu.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/PauseMenu.cs')
-rwxr-xr-xAssets/Scripts/PauseMenu.cs69
1 files changed, 69 insertions, 0 deletions
diff --git a/Assets/Scripts/PauseMenu.cs b/Assets/Scripts/PauseMenu.cs
new file mode 100755
index 0000000..1876fc6
--- /dev/null
+++ b/Assets/Scripts/PauseMenu.cs
@@ -0,0 +1,69 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+using UnityEngine.SceneManagement;
+using UnityEngine.EventSystems;
+
+public class PauseMenu : MonoBehaviour {
+
+ bool Paused;
+ public GameObject PauseMenuPanel;
+ public Button ResumeButton;
+
+ GameObject player;
+ PlayerMovementScript playerMovementScript;
+
+ void Start ()
+ {
+ player = GameObject.FindGameObjectWithTag("Player");
+ playerMovementScript = player.GetComponent<PlayerMovementScript>();
+ //PauseMenuPanel = GameObject.FindGameObjectWithTag("PauseMenu");
+
+ }
+
+ void Update ()
+ {
+ if (Input.GetButtonDown("Pause"))
+ {
+ if (!Paused)
+ {
+ playerMovementScript.StopPlayer();
+ Paused = true;
+ PauseMenuPanel.SetActive(true);
+ Time.timeScale = 0;
+ }
+ else
+ {
+ Paused = false;
+ PauseMenuPanel.SetActive(false);
+ Time.timeScale = 1;
+ }
+ }
+ }
+
+ public void ResumeButtonClick()
+ {
+ if (Paused)
+ {
+ Paused = false;
+ PauseMenuPanel.SetActive(false);
+ Time.timeScale = 1;
+ }
+ }
+
+ public void MainMenuButtonClick(int scene)
+ {
+ SceneManager.LoadScene(scene);
+ Time.timeScale = 1;
+ }
+
+ public void OptionsButtonClick()
+ {
+ }
+
+ public void QuitButtonClick()
+ {
+ Application.Quit();
+ }
+
+}