Commit uncommited stuff I was missing like an idiot
This commit is contained in:
parent
6efd2653a1
commit
9e4ab5f7a3
37 changed files with 3055 additions and 1 deletions
62
Assets/Scripts/UI/GamePausedUI.cs
Normal file
62
Assets/Scripts/UI/GamePausedUI.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GamePausedUI : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private Button resumeButton;
|
||||
[SerializeField] private Button optionsButton;
|
||||
[SerializeField] private Button mainMenuButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
resumeButton.onClick.AddListener(() =>
|
||||
{
|
||||
GameStateManager.Instace.TogglePauseGame();
|
||||
});
|
||||
|
||||
optionsButton.onClick.AddListener(() =>
|
||||
{
|
||||
Hide();
|
||||
OptionsUI.Instance.Show(Show);
|
||||
});
|
||||
|
||||
mainMenuButton.onClick.AddListener(() =>
|
||||
{
|
||||
Loader.Load(Loader.Scene.MainMenuScene);
|
||||
});
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
GameStateManager.Instace.OnGamePaused += GameStateManager_OnGamePaused;
|
||||
GameStateManager.Instace.OnGameUnpaused += GameStateManager_OnGameUnpaused;
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnGameUnpaused(object sender, System.EventArgs e)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnGamePaused(object sender, System.EventArgs e)
|
||||
{
|
||||
Show();
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
resumeButton.Select();
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue