Files
MMORPG/Assets/Scripts/Managers/InputManager.cs

36 lines
758 B
C#

using System;
using UnityEngine;
public class InputManager
{
public Action KeytAction = null;
public Action<Define.MouseEvent> MouseAction = null;
bool _pressed = false;
public void OnUpdate()
{
if (Input.anyKey && KeytAction != null)
{
KeytAction.Invoke();
}
if (MouseAction != null)
{
if (Input.GetMouseButton(0))
{
MouseAction.Invoke(Define.MouseEvent.Press);
_pressed = true;
}
else
{
if (_pressed)
{
MouseAction.Invoke(Define.MouseEvent.Click);
}
_pressed = false;
}
}
}
}