38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class GamePauseUI : MonoBehaviour {
|
|
|
|
|
|
[SerializeField] private Button resumeButton;
|
|
[SerializeField] private Button optionsButton;
|
|
[SerializeField] private Button mainMenuButton;
|
|
|
|
private void Awake() {
|
|
resumeButton.onClick.AddListener(() => KitchenGameManager.Instance.TogglePauseGame());
|
|
optionsButton.onClick.AddListener(() => {
|
|
Hide();
|
|
OptionsUI.Instance.Show(Show);
|
|
});
|
|
mainMenuButton.onClick.AddListener(() => Loader.Load(Loader.Scene.MainMenuScene));
|
|
}
|
|
|
|
private void Start() {
|
|
KitchenGameManager.Instance.OnGamePaused += KitchenGameManager_OnGamePaused;
|
|
KitchenGameManager.Instance.OnGameUnpaused += KitchenGameManager_OnGameUnpaused;
|
|
Hide();
|
|
}
|
|
|
|
private void KitchenGameManager_OnGameUnpaused(object sender, EventArgs e) => Hide();
|
|
|
|
private void KitchenGameManager_OnGamePaused(object sender, EventArgs e) => Show();
|
|
|
|
private void Show()
|
|
{
|
|
gameObject.SetActive(true);
|
|
resumeButton.Select();
|
|
}
|
|
|
|
private void Hide() => gameObject.SetActive(false);
|
|
} |