Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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));
        }