45 lines
968 B
C#
45 lines
968 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PauseMenu : MonoBehaviour{
|
|
|
|
public GameObject pauseMenu;
|
|
|
|
bool gameIsPaused;
|
|
|
|
// Start is called before the first frame update
|
|
void Start(){
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update(){
|
|
if (Input.GetKeyDown(KeyCode.Escape)){
|
|
if (gameIsPaused){
|
|
Time.timeScale = 1;
|
|
pauseMenu.SetActive(false);
|
|
gameIsPaused = false;
|
|
}else{
|
|
Time.timeScale = 0;
|
|
pauseMenu.SetActive(true);
|
|
gameIsPaused = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Continuar(){
|
|
Time.timeScale = 1;
|
|
pauseMenu.SetActive(false);
|
|
gameIsPaused = false;
|
|
}
|
|
|
|
public void Menu(){
|
|
Time.timeScale = 1;
|
|
gameIsPaused = false;
|
|
}
|
|
|
|
public void Quit(){
|
|
Application.Quit();
|
|
}
|
|
}
|