41 lines
751 B
C#
41 lines
751 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MainMenu : MonoBehaviour
|
|
{
|
|
[Header("Buttons")]
|
|
[SerializeField] private Button newGameButton;
|
|
[SerializeField] private Button quitButton;
|
|
|
|
//private void Awake()
|
|
//{
|
|
// Bootstrap();
|
|
//}
|
|
|
|
private void Start()
|
|
{
|
|
Bootstrap();
|
|
}
|
|
|
|
public void Bootstrap()
|
|
{
|
|
if (newGameButton) newGameButton.onClick.AddListener(OnNewGame);
|
|
if (quitButton) quitButton.onClick.AddListener(OnQuit);
|
|
}
|
|
|
|
private void OnNewGame()
|
|
{
|
|
|
|
GameManager.Instance.NewGame();
|
|
}
|
|
|
|
private void OnQuit()
|
|
{
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorApplication.isPlaying = false;
|
|
#else
|
|
Application.Quit();
|
|
#endif
|
|
}
|
|
}
|