forked from whztt07/UnityGameplayAbilitySystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputManager.cs
More file actions
44 lines (37 loc) · 1 KB
/
Copy pathInputManager.cs
File metadata and controls
44 lines (37 loc) · 1 KB
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class InputManager : MonoBehaviour {
public static List<GameObject> ActiveInputComponents = new List<GameObject>();
[SerializeField]
private List<InputHandler> Inputs = new List<InputHandler>();
// Start is called before the first frame update
private void Awake() {
if (!ActiveInputComponents.Find(x => x == this)) {
ActiveInputComponents.Add(gameObject);
}
}
public int InputLength() {
return Inputs.Count;
}
public InputHandler GetElementAt(int i) {
return Inputs[i];
}
private void OnDestroy() {
ActiveInputComponents.Remove(gameObject);
}
}
[Serializable]
public struct InputHandler {
public string Button;
public EButtonState ButtonState;
public UnityEvent Handler;
}
[Flags]
public enum EButtonState {
ButtonDown = 0x01,
ButtonUp = 0x02,
ButtonHeld = 0x04
}