示例#1
0
        // bool crouch is a toggle
        static void Prefix(Player __instance, ref bool crouch)
        {
            if (__instance != Player.m_localPlayer || !VHVRConfig.UseVrControls())
            {
                return;
            }
            // Indicates whether the crouch is toggled on or not
            //bool isCrouchToggled = AccessTools.FieldRefAccess<Player, bool>(__instance, "m_crouchToggled");
            bool isCrouchToggled = __instance.m_crouchToggled;

            if (VHVRConfig.RoomScaleSneakEnabled())
            {
                handleRoomscaleSneak(__instance, ref crouch, isCrouchToggled);
            }
            else
            {
                handleControllerOnlySneak(__instance, ref crouch, isCrouchToggled);
            }
        }
示例#2
0
 private void CheckSneakRoomscale()
 {
     if (VHVRConfig.RoomScaleSneakEnabled())
     {
         float height          = Valve.VR.InteractionSystem.Player.instance.eyeHeight;
         float heightThreshold = referencePlayerHeight * VHVRConfig.RoomScaleSneakHeight();
         if (height < heightThreshold)
         {
             _isRoomscaleSneaking = true;
         }
         else if (height > heightThreshold + heightThreshold * 0.05f)
         {
             _isRoomscaleSneaking = false;
         }
     }
     else
     {
         _isRoomscaleSneaking = false;
     }
 }