using UnityEngine; using UnityEngine.UI; using RR.Game2D.Core; namespace RR.Common.UI { public class MainMenu : MonoBehaviour { [Header("Кнопки")] [SerializeField] private Button newGameButton; [SerializeField] private Button quitButton; //private void Awake() //{ // Bootstrap(); //} private void Start() { Bootstrap(); if (Application.platform == RuntimePlatform.WebGLPlayer) { quitButton.gameObject.SetActive(false); } } /// /// Метод для загрузки элементов сцены. /// Вешает события на кнопки /// public void Bootstrap() { if (newGameButton) newGameButton.onClick.AddListener(OnNewGame); if (quitButton) quitButton.onClick.AddListener(OnQuit); } /// /// Метод начала новой игры /// private void OnNewGame() { GameManager.Instance.NewGame(); } /// /// Метод выхода из игры /// private void OnQuit() { Application.Quit(); } } }