21 lines
766 B
C#
21 lines
766 B
C#
using UnityEngine;
|
|||
|
|
|
||
|
|
public class InputHelper : MonoBehaviour
|
||
|
|
{
|
||
|
|
public static InputHelper Instance;
|
||
|
|
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
if (Instance == null) Instance = this;
|
||
|
|
else Destroy(gameObject);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 提供输入状态给UI层调用
|
||
|
|
public int TouchCount => Input.touchCount;
|
||
|
|
public Touch GetTouch(int index) => Input.GetTouch(index);
|
||
|
|
public bool GetMouseButtonDown(int button) => Input.GetMouseButtonDown(button);
|
||
|
|
public bool GetMouseButton(int button) => Input.GetMouseButton(button);
|
||
|
|
public bool GetMouseButtonUp(int button) => Input.GetMouseButtonUp(button);
|
||
|
|
public Vector3 MousePosition => Input.mousePosition;
|
||
|
|
// public float GetMouseWheelDelta() => Input.GetMouseWheelDelta();
|
||
|
|
}
|