using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class InputManager : MonoBehaviour { public static List ActiveInputComponents = new List(); [SerializeField] private List Inputs = new List(); // 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 }