public void TestQueueEvent()
        {
            var actionBuffers = new ActionBuffers(new ActionSegment <float>(new[] { 1f }), ActionSegment <int> .Empty);
            var context       = new InputActuatorEventContext(1, m_Device);

            using (context.GetEventForFrame(out var eventPtr))
            {
                m_Adaptor.WriteToInputEventForAction(eventPtr, m_Action, m_Control, new ActionSpec(), actionBuffers);
            }
            InputSystem.Update();
            Assert.IsTrue(Mathf.Approximately(1f, (float)m_Action.ReadValue <double>()));
        }
        public void TestQueueEvent()
        {
            var actionBuffers = new ActionBuffers(ActionSegment <float> .Empty, new ActionSegment <int>(new[] { 1 }));
            var context       = new InputActuatorEventContext(1, m_Device);

            using (context.GetEventForFrame(out var eventPtr))
            {
                m_Adaptor.WriteToInputEventForAction(eventPtr, m_Action, m_Control, new ActionSpec(), actionBuffers);
            }
            InputSystem.Update();
            var val = m_Action.ReadValue <int>();

            Assert.IsTrue(val == 1);
        }
        public void TestWriteToHeuristic()
        {
            var actionBuffers = new ActionBuffers(ActionSegment <float> .Empty, new ActionSegment <int>(new[] { 1 }));
            var context       = new InputActuatorEventContext(1, m_Device);

            using (context.GetEventForFrame(out var eventPtr))
            {
                m_Adaptor.WriteToInputEventForAction(eventPtr, m_Action, m_Control, new ActionSpec(), actionBuffers);
            }
            InputSystem.Update();
            var buffer = new ActionBuffers(ActionSegment <float> .Empty, new ActionSegment <int>(new int[1]));

            m_Adaptor.WriteToHeuristic(m_Action, buffer);
            Assert.IsTrue(buffer.DiscreteActions[0] == 1);
        }
Example #4
0
        public void TestWriteToHeuristic()
        {
            var actionBuffers = new ActionBuffers(new ActionSegment <float>(new[] { 1f }), ActionSegment <int> .Empty);
            var context       = new InputActuatorEventContext(1, m_Device);

            using (context.GetEventForFrame(out var eventPtr))
            {
                m_Adaptor.WriteToInputEventForAction(eventPtr, m_Action, m_Control, new ActionSpec(), actionBuffers);
            }
            InputSystem.Update();
            var buffer = new ActionBuffers(new ActionSegment <float>(new[] { 1f }), ActionSegment <int> .Empty);

            m_Adaptor.WriteToHeuristic(m_Action, buffer);
            Assert.IsTrue(Mathf.Approximately(1f, buffer.ContinuousActions[0]));
        }