public IObservable <RegistrationValue> RegisterInputAction(InputActionType inputActionType, CoreActionEventType coreActionEventType) { switch (coreActionEventType) { case CoreActionEventType.Started: return(_subscriptions[inputActionType].OnActionStarted); case CoreActionEventType.Performed: return(_subscriptions[inputActionType].OnActionPerformed); case CoreActionEventType.Canceled: return(_subscriptions[inputActionType].OnActionCancelled); default: throw new ArgumentOutOfRangeException(nameof(coreActionEventType), coreActionEventType, "RegisterInputAction critical error. Verify that subscriptions are setup correctly."); } }
private void ActionEvent(InputAction inputAction, InputActionType inputActionType, CoreActionEventType coreActionEventType) { if (_subscriptions.ContainsKey(inputActionType)) { var value = _subscriptions[inputActionType].RegistrationValue; value.InputAction = inputAction; value.InputActionType = inputActionType; value.CoreActionEventType = coreActionEventType; switch (coreActionEventType) { case CoreActionEventType.Started: _subscriptions[inputActionType].OnActionStarted.OnNext(value); break; case CoreActionEventType.Performed: _subscriptions[inputActionType].OnActionPerformed.OnNext(value); break; case CoreActionEventType.Canceled: _subscriptions[inputActionType].OnActionCancelled.OnNext(value); break; } } }