public void TODO_State_CanRecordHistoryOfState() { var gamepad = InputSystem.AddDevice <Gamepad>(); //have to record raw, unprocessed state; deadzone processor will break asserts below, though using (var history = new InputStateHistory <Vector2>(gamepad.leftStick)) { history.Enable(); InputSystem.QueueStateEvent(gamepad, new GamepadState { leftStick = new Vector2(0.123f, 0.234f) }); InputSystem.QueueStateEvent(gamepad, new GamepadState { leftStick = new Vector2(0.345f, 0.456f) }); InputSystem.Update(); InputSystem.QueueStateEvent(gamepad, new GamepadState { leftStick = new Vector2(0.567f, 0.678f) }); InputSystem.Update(); Assert.That(history.Count, Is.EqualTo(3)); Assert.That(history[0], Is.EqualTo(new Vector2(0.123f, 0.234f)).Using(Vector2EqualityComparer.Instance)); Assert.That(history[1], Is.EqualTo(new Vector2(0.345f, 0.456f)).Using(Vector2EqualityComparer.Instance)); Assert.That(history[2], Is.EqualTo(new Vector2(0.567f, 0.678f)).Using(Vector2EqualityComparer.Instance)); } }
internal TouchHistory(Finger finger, InputStateHistory <TouchState> history, int startIndex = -1, int count = -1) { m_Finger = finger; m_History = history; m_Version = history.version; m_Count = count >= 0 ? count : m_History.Count; m_StartIndex = startIndex >= 0 ? startIndex : m_History.Count - 1; }