void OnGamePaused(bool isPaused, float routineTime)
 {
     if (isPaused)
     {
         VRUIInput.SetUIHand(SteamVR_Input_Sources.Any);
     }
 }
        public static bool ActionOccupied(SteamVR_Action action, SteamVR_Input_Sources forHand)
        {
            if (VRUIInput.ActionOccupied(action, forHand))
            {
                return(true);
            }

            SteamVR_Input_Sources handValue;

            if (occupiedActions.TryGetValue(action, out handValue))
            {
                return(handValue != SteamVR_Input_Sources.Keyboard && forHand == handValue);
            }
            else
            {
                return(false);
            }
        }
        void InputUpdateLoop(float deltaTime)
        {
            CheckCrouched(deltaTime);

            bool movementEnabled = !GameManager.isPaused && !isClimbing;

            CheckForJump(movementEnabled && !VRUIInput.HandOccupied(moveHand)); // also when jump hand isnt hovering

            HandleTurnInput(movementEnabled && !VRUIInput.HandOccupied(turnHand));
            HandleMoveInput(movementEnabled && !VRUIInput.HandOccupied(moveHand));
            if (!isClimbing)
            {
                moveScript.SetInputMoveVector(new Vector3(currentMoveVector.x, 0, currentMoveVector.y));
            }

            bool enableComfortVignette = smoothTurnDirection != 0 || !moveScript.isGrounded || isCrouched;

            if (!enableComfortVignette)
            {
                enableComfortVignette = moveScript.isMoving && currentMoveVector.sqrMagnitude >= vignetteMovementThreshold * vignetteMovementThreshold;
            }
            HandleComfortVignetting(enableComfortVignette, deltaTime);
        }
        protected virtual void Update()
        {
            UpdateDebugText();

            bool handOccupied = VRUIInput.HandOccupied(handType);

            bool useDown = !handOccupied && useAction.GetStateDown(handType);
            bool useUp   = !handOccupied && useAction.GetStateUp(handType);
            bool useHeld = !handOccupied && useAction.GetState(handType);

            if (useDown)
            {
                StandardizedVRInput.instance.HideHint(handType, useAction);
                // inventory.SetMainEquipPointIndex(myEquipIndex);

                if (canQuickEquip)
                {
                    interactor.OnUseStart(inventory.GRAB_ACTION);
                }

                inventory.OnUseStart(myEquipIndex, inventory.GRAB_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
            if (useUp)
            {
                // inventory.SetMainEquipPointIndex(myEquipIndex);

                if (canQuickEquip)
                {
                    interactor.OnUseEnd(inventory.GRAB_ACTION);
                }

                inventory.OnUseEnd(myEquipIndex, inventory.GRAB_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
            if (useHeld)
            {
                // inventory.SetMainEquipPointIndex(myEquipIndex);

                if (canQuickEquip)
                {
                    interactor.OnUseUpdate(inventory.GRAB_ACTION);
                }

                inventory.OnUseUpdate(myEquipIndex, inventory.GRAB_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }



            useDown = !handOccupied && stashAction.GetStateDown(handType);
            useUp   = !handOccupied && stashAction.GetStateUp(handType);
            useHeld = !handOccupied && stashAction.GetState(handType);

            if (useDown)
            {
                StandardizedVRInput.instance.HideHint(handType, stashAction);
                // inventory.SetMainEquipPointIndex(myEquipIndex);
                interactor.OnUseStart(inventory.STASH_ACTION);
                inventory.OnUseStart(myEquipIndex, inventory.STASH_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
            if (useUp)
            {
                // inventory.SetMainEquipPointIndex(myEquipIndex);
                interactor.OnUseEnd(inventory.STASH_ACTION);
                inventory.OnUseEnd(myEquipIndex, inventory.STASH_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
            if (useHeld)
            {
                // inventory.SetMainEquipPointIndex(myEquipIndex);
                interactor.OnUseUpdate(inventory.STASH_ACTION);
                inventory.OnUseUpdate(myEquipIndex, inventory.STASH_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }



            useDown = !handOccupied && dropAction.GetStateDown(handType);
            useUp   = !handOccupied && dropAction.GetStateUp(handType);
            useHeld = !handOccupied && dropAction.GetState(handType);

            if (useDown)
            {
                StandardizedVRInput.instance.HideHint(handType, dropAction);
                // inventory.SetMainEquipPointIndex(myEquipIndex);
                interactor.OnUseStart(inventory.TRADE_ACTION);
                inventory.OnUseStart(myEquipIndex, inventory.TRADE_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
            if (useUp)
            {
                // inventory.SetMainEquipPointIndex(myEquipIndex);
                interactor.OnUseEnd(inventory.TRADE_ACTION);
                inventory.OnUseEnd(myEquipIndex, inventory.TRADE_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
            if (useHeld)
            {
                // inventory.SetMainEquipPointIndex(myEquipIndex);
                interactor.OnUseUpdate(inventory.TRADE_ACTION);
                inventory.OnUseUpdate(myEquipIndex, inventory.TRADE_ACTION);
                // inventory.SetMainEquipPointIndex(-1);
            }
        }
 void OnUISelection(GameObject[] data, object[] customData)
 {
     // float duration,  float frequency, float amplitude
     StandardizedVRInput.instance.TriggerHapticPulse(VRUIInput.GetUIHand(), .1f, 1.0f, 1.0f);
 }
        void OnInventoryUIOpen(InventoryUI.UIType type, UIElementHolder uiHolder)
        {
            SteamVR_Input_Sources hand;

            switch (type)
            {
            // quick inventory
            case InventoryUI.UIType.QuickInventory:
                hand = VRManager.Int2Hand(inventoryUI.quickInventoryInteractorID);

                StandardizedVRInput.MarkActionOccupied(QUICK_INVENTORY_CONSUME_ACTION, VRUIInput.GetUIHand());
                StandardizedVRInput.instance.ShowHint(hand, QUICK_INVENTORY_CONSUME_ACTION, "Use");

                TransformBehavior.AdjustTransform(uiHolder.baseObject.transform, Player.instance.GetHand(hand).transform, quickInventoryEquip, 0);

                VRUIInput.SetUIHand(hand);
                break;

            // full inventory
            case InventoryUI.UIType.FullInventory:
                StandardizedVRInput.MarkActionOccupied(FULL_INVENTORY_CONSUME_ACTION, SteamVR_Input_Sources.Any);
                StandardizedVRInput.MarkActionOccupied(FULL_INVENTORY_DROP_ACTION, SteamVR_Input_Sources.Any);
                // StandardizedVRInput.MarkActionOccupied(FULL_INVENTORY_FAVORITE_ACTION, SteamVR_Input_Sources.Any);

                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.RightHand, FULL_INVENTORY_CONSUME_ACTION, "Use Right Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.LeftHand, FULL_INVENTORY_CONSUME_ACTION, "Use Left Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_DROP_ACTION, "Drop");
                // StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_INVENTORY_FAVORITE_ACTION, "Favorite");

                VRUIInput.SetUIHand(SteamVR_Input_Sources.Any);
                break;

            // quick trade
            case InventoryUI.UIType.QuickTrade:
                hand = VRManager.Int2Hand(inventoryUI.quickTradeInteractorID);

                StandardizedVRInput.MarkActionOccupied(QUICK_TRADE_SINGLE_TRADE_ACTION, hand);
                StandardizedVRInput.MarkActionOccupied(QUICK_TRADE_TRADE_ALL_ACTION, hand);
                StandardizedVRInput.MarkActionOccupied(QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION, hand);

                StandardizedVRInput.instance.ShowHint(hand, QUICK_TRADE_SINGLE_TRADE_ACTION, "Take Item");
                StandardizedVRInput.instance.ShowHint(hand, QUICK_TRADE_TRADE_ALL_ACTION, "Take All");
                StandardizedVRInput.instance.ShowHint(hand, QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION, "Open Trade");

                TransformBehavior.AdjustTransform(uiHolder.baseObject.transform, Player.instance.GetHand(hand).transform, quickTradeEquip, 0);

                VRUIInput.SetUIHand(hand);

                break;

            // full trade
            case InventoryUI.UIType.FullTrade:

                StandardizedVRInput.MarkActionOccupied(FULL_TRADE_CONSUME_ACTION, SteamVR_Input_Sources.Any);
                StandardizedVRInput.MarkActionOccupied(FULL_TRADE_TRADE_ALL_ACTION, SteamVR_Input_Sources.Any);
                StandardizedVRInput.MarkActionOccupied(FULL_TRADE_SINGLE_TRADE_ACTION, SteamVR_Input_Sources.Any);

                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.RightHand, FULL_TRADE_CONSUME_ACTION, "Use Right Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.LeftHand, FULL_TRADE_CONSUME_ACTION, "Use Left Hand");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_TRADE_SINGLE_TRADE_ACTION, "Trade Item");
                StandardizedVRInput.instance.ShowHint(SteamVR_Input_Sources.Any, FULL_TRADE_TRADE_ALL_ACTION, "Trade All");

                VRUIInput.SetUIHand(SteamVR_Input_Sources.Any);
                break;
            }
        }