private void ResetControlsForCurrentReceivers() { // Set state to inactive temporarily, so subsequent ActionMaps receive the reset events. bool oldActiveState = m_Active; m_Active = false; for (int i = 0; i < m_DeviceStates.Count; i++) { var state = m_DeviceStates[i]; for (int j = 0; j < state.count; j++) { if (blockSubsequent || state.IsControlEnabled(j)) { GenericControlEvent evt = new GenericControlEvent() { device = state.controlProvider as InputDevice, controlIndex = j, value = state.controlProvider.GetControlData(j).defaultValue, time = Time.time }; // TODO: Revise off design of IInputConsumer that doesn't have method for invoking event. var node = InputSystem.consumerStack as InputEventTree; node.ProcessEvent(evt); } } } m_Active = oldActiveState; }
private void ResetControlsForCurrentReceivers() { // Set state to inactive temporarily, so subsequent ActionMaps receive the reset events. bool oldActiveState = m_Active; m_Active = false; for (int i = 0; i < m_DeviceStates.Count; i++) { var state = m_DeviceStates[i]; for (int j = 0; j < state.count; j++) { if (blockSubsequent || state.IsControlEnabled(j)) { GenericControlEvent evt = new GenericControlEvent() { device = state.controlProvider as InputDevice, controlIndex = j, value = state.controlProvider.GetControlData(j).defaultValue, time = Time.time }; InputSystem.consumers.ProcessEvent(evt); } } } m_Active = oldActiveState; }
public virtual bool ProcessEventIntoState(InputEvent inputEvent, InputState intoState) { GenericControlEvent controlEvent = inputEvent as GenericControlEvent; if (controlEvent == null) { return(false); } return(intoState.SetCurrentValue(controlEvent.controlIndex, controlEvent.value)); }