Practice_Unity/Assets/Scripts/Managers/InputManager.cs
Seonkyu.kim 04c6301b7c 작업
1. 애니메이터 매니저 완성
2. 플레이어 컨트롤러 마우스 이동 부분 만들어 야 함
  - 이전꺼 넣어서 해보려는데도 도저히 되지가 않는다...
2025-09-18 17:58:51 +09:00

39 lines
946 B
C#

using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
public class InputManager: IManager
{
public Action KeyAction = null;
public Action<Define.MouseEvent> 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;
}
}