Ejemplo n.º 1
0
    void Update()
    {
        if (!eou.IsReady())
        {
            eou.StartOpenVR();
        }

        if (HMD_Offset == null || LeftHand_Offset == null || RightHand_Offset == null)
        {
            HMD_Offset       = eou.GetHMDTransform();
            LeftHand_Offset  = eou.GetLeftControllerTransform();
            RightHand_Offset = eou.GetRightControllerTransform();
        }

        eou.AutoExitOnQuit();

        _config = configManager.GetConfig();

        HMDTrans       = eou.GetHMDTransform();
        LeftHandTrans  = eou.GetLeftControllerTransform();
        RightHandTrans = eou.GetRightControllerTransform();

        eou.SetGameObjectTransform(ref HMD, HMDTrans);
        eou.SetGameObjectTransform(ref LeftHand, LeftHandTrans);
        eou.SetGameObjectTransform(ref RightHand, RightHandTrans);

        eou.SetGameObjectTransformWithOffset(ref HMD_withOffset, HMDTrans, HMD_Offset);
        eou.SetGameObjectTransformWithOffset(ref LeftHand_withOffset, LeftHandTrans, LeftHand_Offset);
        eou.SetGameObjectTransformWithOffset(ref RightHand_withOffset, RightHandTrans, RightHand_Offset);

        ulong button;

        if (isFollowRightHand)
        {
            eou.GetControllerButtonPressed(eou.GetRightControllerIndex(), out button);
        }
        else
        {
            eou.GetControllerButtonPressed(eou.GetLeftControllerIndex(), out button);
        }
        if (button != 0)
        {
            V_Chest.SetActive(false);
            V_Foot_L.SetActive(false);
            V_Foot_R.SetActive(false);
            V_Offset.SetActive(false);
        }

        if (_config.isMenuLeftHand && LeftHandTrans != null && LeftHandTrans.velocity.y < -3.5f || _config.isMenuRightHand && RightHandTrans != null && RightHandTrans.velocity.y < -3.5f)
        {
            if (!MenuManager.IsActive() && (!_config.isMenuLock || _config.MenuLockButton == 0 || _config.MenuLockButton == button))
            {
                MenuManager.Open();
            }
        }
        else if (_config.isMenuLeftHand && LeftHandTrans != null && LeftHandTrans.velocity.y > 3.5f || _config.isMenuRightHand && RightHandTrans != null && RightHandTrans.velocity.y > 3.5f)
        {
            if (MenuManager.IsActive() && (!_config.isMenuLock || _config.MenuLockButton == 0 || _config.MenuLockButton == button))
            {
                MenuManager.Close();
            }
        }
    }