Esempio n. 1
0
    protected virtual void LateUpdate()
    {
        var needUpdate = false;

        switch (laserPointerActiveMode)
        {
        case LaserPointerActiveModeEnum.None:
            needUpdate |= SetRightLaserPointerActive(false);
            needUpdate |= SetLeftLaserPointerActive(false);
            break;

        case LaserPointerActiveModeEnum.ToggleByMenuClick:
            if (ViveInput.GetPressUpEx(HandRole.RightHand, ControllerButton.Menu))
            {
                ToggleRightLaserPointer();
                needUpdate = true;
            }

            if (ViveInput.GetPressUpEx(HandRole.LeftHand, ControllerButton.Menu))
            {
                ToggleLeftLaserPointer();
                needUpdate = true;
            }
            break;
        }

        switch (curvePointerActiveMode)
        {
        case CurvePointerActiveModeEnum.None:
            needUpdate |= SetRightCurvePointerActive(false);
            needUpdate |= SetLeftCurvePointerActive(false);
            break;

        case CurvePointerActiveModeEnum.ActiveOnPadPressed:
            needUpdate |= SetRightCurvePointerActive(ViveInput.GetPressEx(HandRole.RightHand, ControllerButton.Pad));
            needUpdate |= SetLeftCurvePointerActive(ViveInput.GetPressEx(HandRole.LeftHand, ControllerButton.Pad));
            break;

        case CurvePointerActiveModeEnum.ToggleByPadDoubleClick:
            if (ViveInput.GetPressDownEx(HandRole.RightHand, ControllerButton.Pad) && ViveInput.ClickCountEx(HandRole.RightHand, ControllerButton.Pad) == 2)
            {
                ToggleRightCurvePointer();
                needUpdate = true;
            }

            if (ViveInput.GetPressDownEx(HandRole.LeftHand, ControllerButton.Pad) && ViveInput.ClickCountEx(HandRole.LeftHand, ControllerButton.Pad) == 2)
            {
                ToggleLeftCurvePointer();
                needUpdate = true;
            }
            break;
        }

        switch (customModelActiveMode)
        {
        case CustomModelActiveModeEnum.None:
            needUpdate |= ChangeProp.Set(ref m_rightCustomModelActive, false);
            needUpdate |= ChangeProp.Set(ref m_leftCustomModelActive, false);
            break;

        case CustomModelActiveModeEnum.ActiveOnGripped:
            needUpdate |= SetRightCustomModelActive(ViveInput.GetPressEx(HandRole.RightHand, ControllerButton.Grip));
            needUpdate |= SetLeftCustomModelActive(ViveInput.GetPressEx(HandRole.LeftHand, ControllerButton.Grip));
            break;

        case CustomModelActiveModeEnum.ToggleByDoubleGrip:
            if (ViveInput.GetPressDownEx(HandRole.RightHand, ControllerButton.Grip) && ViveInput.ClickCountEx(HandRole.RightHand, ControllerButton.Grip) == 2)
            {
                ToggleRightCustomModel();
                needUpdate = true;
            }
            if (ViveInput.GetPressDownEx(HandRole.LeftHand, ControllerButton.Grip) && ViveInput.ClickCountEx(HandRole.LeftHand, ControllerButton.Grip) == 2)
            {
                ToggleLeftCustomModel();
                needUpdate = true;
            }
            break;
        }

        if (needUpdate)
        {
            UpdateActivity();
        }
    }