44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
|
/*
|
||
|
* author: mark joshwel
|
||
|
* date: 20/6/2024
|
||
|
* description: script for handling 'caught' and 'escaped' menu button functions
|
||
|
*/
|
||
|
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UIElements;
|
||
|
|
||
|
/// <summary>
|
||
|
/// class managing the credits menu and button function invocations
|
||
|
/// </summary>
|
||
|
public class CaughtEscapedMenu : CommonMenu
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// button to exit the game
|
||
|
/// </summary>
|
||
|
public Button ButtonExit;
|
||
|
|
||
|
/// <summary>
|
||
|
/// function to associate a display state with the menu,
|
||
|
/// and subscribe button events to their respective functions
|
||
|
/// </summary>
|
||
|
public override void OnEnable()
|
||
|
{
|
||
|
// set the associated state and call the base OnEnable
|
||
|
base.OnEnable();
|
||
|
|
||
|
// get the exit button from the ui root and subscribe appropriate functions
|
||
|
ButtonExit = UI.Q<Button>("ButtonExit");
|
||
|
ButtonExit.clicked += PlayClick;
|
||
|
ButtonExit.clicked += OptionQuitGame;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// handles "exit game" button press,
|
||
|
/// signals the game manager appropriately
|
||
|
/// </summary>
|
||
|
private void OptionQuitGame()
|
||
|
{
|
||
|
Debug.Log("CaughtEscapedMenu.OptionQuitGame: exiting");
|
||
|
GameManager.Instance.Quit();
|
||
|
}
|
||
|
}
|