Ejemplo n.º 1
0
        private void UpdateControllerState(int index)
        {
            m_NativeController.UpdateState(index);
            states[index].controllerType   = m_NativeController.GetControllerType(index);
            states[index].availableFeature = (ControllerAvailableFeature)m_NativeController.GetAvailableFeatures(index);
            states[index].connectionState  = m_NativeController.GetConnectionState(index);
            states[index].rotation         = m_NativeController.GetPose(index).rotation;
            states[index].position         = m_NativeController.GetPose(index).position;
            states[index].gyro             = m_NativeController.GetGyro(index);
            states[index].accel            = m_NativeController.GetAccel(index);
            states[index].mag          = m_NativeController.GetMag(index);
            states[index].touchPos     = m_NativeController.GetTouch(index);
            states[index].isTouching   = m_NativeController.IsTouching(index);
            states[index].recentered   = false;
            states[index].isCharging   = m_NativeController.IsCharging(index);
            states[index].batteryLevel = m_NativeController.GetBatteryLevel(index);
            states[index].buttonsState = (ControllerButton)m_NativeController.GetButtonState(index);
            states[index].buttonsDown  = (ControllerButton)m_NativeController.GetButtonDown(index);
            states[index].buttonsUp    = (ControllerButton)m_NativeController.GetButtonUp(index);

            IControllerStateParser stateParser = ControllerStateParseUtility.GetControllerStateParser(states[index].controllerType, index);

            if (stateParser != null)
            {
                stateParser.ParserControllerState(states[index]);
            }
            CheckRecenter(index);
        }
        private void UpdateControllerState(int index)
        {
            m_NativeController.UpdateState(index);
            states[index].controllerType = m_NativeController.GetControllerType(index);
#if UNITY_EDITOR
            if (NRInput.EmulateVirtualDisplayInEditor)
            {
                states[index].controllerType = ControllerType.CONTROLLER_TYPE_PHONE;
            }
#endif
            states[index].availableFeature = (ControllerAvailableFeature)m_NativeController.GetAvailableFeatures(index);
            states[index].connectionState  = m_NativeController.GetConnectionState(index);
            states[index].rotation         = m_NativeController.GetPose(index).rotation;
            states[index].position         = m_NativeController.GetPose(index).position;
            states[index].gyro             = m_NativeController.GetGyro(index);
            states[index].accel            = m_NativeController.GetAccel(index);
            states[index].mag          = m_NativeController.GetMag(index);
            states[index].touchPos     = m_NativeController.GetTouch(index);
            states[index].isTouching   = m_NativeController.IsTouching(index);
            states[index].recentered   = false;
            states[index].isCharging   = m_NativeController.IsCharging(index);
            states[index].batteryLevel = m_NativeController.GetBatteryLevel(index);
            states[index].buttonsState = (ControllerButton)m_NativeController.GetButtonState(index);
            states[index].buttonsDown  = (ControllerButton)m_NativeController.GetButtonDown(index);
            states[index].buttonsUp    = (ControllerButton)m_NativeController.GetButtonUp(index);

            IControllerStateParser stateParser = ControllerStateParseUtility.GetControllerStateParser(states[index].controllerType, index);
            if (stateParser != null)
            {
                stateParser.ParserControllerState(states[index]);
            }
            CheckRecenter(index);
        }