DongYingLiangGuanYiGong/Assets/Zion/Scripts/Move/UtilityInput.cs

39 lines
2.1 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 MouseDown { get => Input.GetMouseButtonDown(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 float Updown { get => Input.GetAxis("Updown"); }
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)|| Input.GetKey(KeyCode.Q); } }
public static bool Up { get { return Input.GetKey(KeyCode.X)|| Input.GetKey(KeyCode.E); } }
public static bool Sprint { get { return Input.GetKey(KeyCode.LeftShift); } }
public static bool isMoving { get { return Horizontal!=0||Vertical!=0||Scroll!=0; } }
}