using System; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; public class InputManager: IManager { public Action KeyAction = null; public Action MouseAction = null; bool _pressed = false; public void Update() { // UI 위에 마우스 있으면 리턴 if(EventSystem.current.IsPointerOverGameObject()) return; if (Input.anyKey && KeyAction != null) KeyAction.Invoke(); if (MouseAction != null) { if (Input.GetMouseButton(0)) { MouseAction.Invoke(Define.MouseEvent.Down); _pressed = true; } else { if (_pressed) MouseAction.Invoke(Define.MouseEvent.Up); _pressed = false; } } } public void Clear() { KeyAction = null; MouseAction = null; } }