/// <summary> /// Internal method handling all actions triggered by the new input system. /// </summary> protected virtual void OnActionTriggered(InputAction.CallbackContext context) { if (context.action.triggered == false || ListenerDictionary.ContainsKey(context.action.name) == false) { return; } List <ListenerInfo> infoList = ListenerDictionary[context.action.name]; foreach (ListenerInfo info in infoList) { try { if (CurrentInputFocus != null && info.ActionListener.IgnoreFocus == false && info.ActionListener != CurrentInputFocus) { break; } info.Action(new InputEventArgs(context)); } catch (Exception ex) { Debug.LogError(ex); } } }
private void Awake() { if (INSTANCE == null) { INSTANCE = this; } _enterStateListeners = new ListenerDictionary <GameState>(); _exitStateListeners = new ListenerDictionary <GameState>(); }