public void OnBeforeUpdate() { Profiler.BeginSample("GamepadStateService.OnBeforeUpdate"); if (m_adapter != null) { for (int gi = 0; gi < NUMBER_OF_GAMEPADS; gi++) { for (int bi = 0; bi < NUMBER_OF_BUTTONS; bi++) { m_buttonStates[gi, bi] = m_adapter.GetButtonDown((GamepadButton)bi, (GamepadIndex)gi); } for (int ai = 0; ai < NUMBER_OF_AXES; ai++) { float value = m_adapter.GetAxis((GamepadAxis)ai, (GamepadIndex)gi); m_axisStates[gi, ai] = Mathf.Abs(value - m_lastAxisValues[gi, ai]) >= MIN_AXIS_DELTA; m_lastAxisValues[gi, ai] = value; } } } Profiler.EndSample(); }