blob: 32beebb8ba7640d5c29c86a60cc7585bceb75515 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
using UnityEngine;
namespace Mountools.Tools
{
public class MountoolsShortcut
{
public static bool ctrl =>
Input.GetKey(KeyCode.LeftControl)
|| Input.GetKey(KeyCode.LeftCommand)
|| Input.GetKey(KeyCode.RightControl)
|| Input.GetKey(KeyCode.RightCommand);
public static bool shift =>
Input.GetKey(KeyCode.LeftShift)
|| Input.GetKey(KeyCode.RightShift);
public static bool alt =>
Input.GetKey(KeyCode.LeftAlt)
|| Input.GetKey(KeyCode.RightAlt);
public static bool Ctrl(KeyCode keyCode, bool checkHold = false)
{
return ctrl && !shift && !alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
public static bool CtrlShift(KeyCode keyCode, bool checkHold = false)
{
return ctrl && shift && !alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
public static bool CtrlAlt(KeyCode keyCode, bool checkHold = false)
{
return ctrl && !shift && alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
public static bool CtrlShiftAlt(KeyCode keyCode, bool checkHold = false)
{
return ctrl && shift && alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
public static bool Shift(KeyCode keyCode, bool checkHold = false)
{
return !ctrl && shift && !alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
public static bool ShiftAlt(KeyCode keyCode, bool checkHold = false)
{
return !ctrl && shift && alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
public static bool Alt(KeyCode keyCode, bool checkHold = false)
{
return !ctrl && !shift && alt && (checkHold ? Input.GetKey(keyCode) : Input.GetKeyDown(keyCode));
}
}
}
|