您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
35 行
744 B
35 行
744 B
using UnityEngine;
|
|
|
|
public class MenuController : MonoBehaviour
|
|
{
|
|
[SerializeField] private InputReader _inputReader;
|
|
[SerializeField] private GameObject _menuPrefab;
|
|
private GameObject _menuInstance;
|
|
|
|
private void OnEnable()
|
|
{
|
|
//_inputReader.menuPauseEvent += OpenMenu;
|
|
//_inputReader.menuUnpauseEvent += UnpauseMenu;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
//_inputReader.menuPauseEvent -= OpenMenu;
|
|
//_inputReader.menuUnpauseEvent -= UnpauseMenu;
|
|
}
|
|
|
|
private void OpenMenu()
|
|
{
|
|
if (_menuInstance == null)
|
|
_menuInstance = Instantiate(_menuPrefab);
|
|
|
|
_menuInstance.SetActive(true);
|
|
_inputReader.EnableMenuInput();
|
|
}
|
|
|
|
private void UnpauseMenu()
|
|
{
|
|
_menuInstance.SetActive(false);
|
|
_inputReader.EnableGameplayInput();
|
|
}
|
|
}
|