ict.shenzhi/Assets/Scripts/CameraCtrl/UtilityInput.cs

35 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class UtilityInput
{
public static float Scroll { get => Input.GetAxis("Mouse ScrollWheel"); }
public static float MouseMoveX { get => Input.GetAxis("Mouse X"); }
public static float MouseMoveY { get => Input.GetAxis("Mouse Y"); }
public static bool HoldLeftMouse { get => Input.GetMouseButton(0); }
public static bool HoldRightMouse { get => Input.GetMouseButton(1); }
public static bool HoldMiddleMouse { get => Input.GetMouseButton(2); }
public static bool MouseUp { get => Input.GetMouseButtonUp(0); }
public static bool IsOverUI { get => EventSystem.current.IsPointerOverGameObject(); }
public static bool AnyMouseDown { get => Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2); }
public static bool AnyMouseUp { get => Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(2); }
public static float Horizontal { get => Input.GetAxis("Horizontal"); }
public static float Vertical { get => Input.GetAxis("Vertical"); }
public static bool LeftShift { get => Input.GetKey(KeyCode.LeftShift); }
public static bool GetMouse(int _mouse) =>Input.GetMouseButton(_mouse);
public static bool SpeedUp => Input.GetKey(KeyCode.LeftShift);
//public static float Horizontal => Input.GetAxis("Horizontal");
//public static float Vertical => Input.GetAxis("Vertical");
public static bool OverUI => EventSystem.current.IsPointerOverGameObject();
public static bool Down { get { return Input.GetKey(KeyCode.Z); } }
public static bool Up { get { return Input.GetKey(KeyCode.X); } }
public static bool Sprint { get { return Input.GetKey(KeyCode.LeftShift); } }
}