SynthMaze/Assets/game/Scripts/UI/Pause.cs
2024-04-28 11:26:46 +02:00

36 lines
859 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pause : MonoBehaviour
{
public static bool IsPause = false;
public GameObject CoinCounterUI;
public GameObject PauseButton;
public GameObject PauseMenu;
//public Animator animator; // remove '//' for Shanti Manti
void Start()
{
CoinCounterUI.SetActive(true);
PauseButton.SetActive(true);
PauseMenu.SetActive(false);
IsPause = false;
}
void Update()
{
if ((Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.P)))
{
PauseGame();
}
}
public void PauseGame()
{
IsPause = !IsPause;
PauseMenu.SetActive(IsPause);
PauseButton.SetActive(!IsPause);
CoinCounterUI.SetActive(!IsPause);
}
}