mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
Added Pause Menu
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class MenuController : MonoBehaviour
|
||||
{
|
||||
public GameObject pauseMenu;
|
||||
public bool isPaused;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
if (isPaused)
|
||||
{
|
||||
ResumeGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
isPaused = true;
|
||||
pauseMenu.SetActive(true);
|
||||
Time.timeScale = 0f;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeGame()
|
||||
{
|
||||
isPaused = false;
|
||||
pauseMenu.SetActive(false);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
|
||||
public void ReturnToMain()
|
||||
{
|
||||
SceneManager.LoadScene("Main Menu");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user