您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
50 行
1.1 KiB
50 行
1.1 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public static class GatedInput
|
|
{
|
|
[Flags]
|
|
public enum Blocker
|
|
{
|
|
None = 0,
|
|
Console = 1,
|
|
Chat = 2,
|
|
Debug = 4,
|
|
}
|
|
static Blocker blocks;
|
|
|
|
public static void SetBlock(Blocker b, bool value)
|
|
{
|
|
if (value)
|
|
blocks |= b;
|
|
else
|
|
blocks &= ~b;
|
|
}
|
|
|
|
public static float GetAxisRaw(string axis)
|
|
{
|
|
return blocks != Blocker.None ? 0.0f : UnityEngine.Input.GetAxisRaw(axis);
|
|
}
|
|
|
|
public static bool GetKey(KeyCode key)
|
|
{
|
|
return blocks != Blocker.None ? false : UnityEngine.Input.GetKey(key);
|
|
}
|
|
|
|
public static bool GetKeyDown(KeyCode key)
|
|
{
|
|
return blocks != Blocker.None ? false : UnityEngine.Input.GetKeyDown(key);
|
|
}
|
|
|
|
public static bool GetMouseButton(int button)
|
|
{
|
|
return blocks != Blocker.None ? false : UnityEngine.Input.GetMouseButton(button);
|
|
}
|
|
|
|
public static bool GetKeyUp(KeyCode key)
|
|
{
|
|
return blocks != Blocker.None ? false : UnityEngine.Input.GetKeyUp(key);
|
|
}
|
|
}
|