浏览代码

debug

/main
kgc00 4 年前
当前提交
922a3b98
共有 2 个文件被更改,包括 36 次插入0 次删除
  1. 33
      UOP1_Project/Assets/Scripts/Menu/DebugMenu.cs
  2. 3
      UOP1_Project/Assets/Scripts/Menu/DebugMenu.cs.meta

33
UOP1_Project/Assets/Scripts/Menu/DebugMenu.cs


using System;
using UnityEngine;
public class DebugMenu : MonoBehaviour
{
[SerializeField] private GameObject _menuPrefab;
private GameObject _menuInstance;
[SerializeField] private InputReader _inputReader;
private void OnEnable()
{
_inputReader.pauseEvent += OpenMenu;
_inputReader.Menu.CloseMenuEvent += CloseMenu;
}
private void OnDisable()
{
_inputReader.pauseEvent -= OpenMenu;
_inputReader.Menu.CloseMenuEvent -= CloseMenu;
}
private void OpenMenu()
{
if (_menuInstance == null) _menuInstance = Instantiate(_menuPrefab);
_menuInstance.SetActive(true);
_inputReader.EnableMenuInput();
}
private void CloseMenu()
{
_menuInstance.SetActive(false);
_inputReader.EnableGameplayInput();
}
}

3
UOP1_Project/Assets/Scripts/Menu/DebugMenu.cs.meta


fileFormatVersion: 2
guid: bfb8a0b36800464dab759d2f75a1b6a0
timeCreated: 1605314932
正在加载...
取消
保存