protected virtual void Awake() { AdditionalInitialization(); trackedObject = GetComponent <SteamVR_Behaviour_Pose>(); interactor = GetComponent <Interactor>(); inventory = Player.instance.GetComponent <Inventory>(); interactor.interactorID = VRManager.Hand2Int(handType); GetComponent <EquipPoint>().equipID = interactor.interactorID; }
Vector2Int GetAlternativeSubmitsQI() { SteamVR_Input_Sources hand = VRManager.Int2Hand(inventoryUI.quickInventoryInteractorID); // SteamVR_Input_Sources hand = VRUIInput.GetUIHand(); if (QUICK_INVENTORY_CONSUME_ACTION.GetStateDown(hand)) { return(new Vector2Int(InventoryUI.QUICK_INVENTORY_CONSUME_ACTION, inventoryUI.quickInventoryInteractorID));//VRManager.Hand2Int(hand)); } return(new Vector2Int(-1, 1)); }
bool CheckHandForWristRadialOpen(SteamVR_Input_Sources hand) { if (quickInventoryToggle.GetStateDown(hand)) { Debug.LogError("YO"); inventoryUI.OpenQuickInventoryUI(VRManager.Hand2Int(hand)); // VRUIInput.SetUIHand(hand); // TransformBehavior.AdjustTransform(inventoryUI.quickInventory.baseObject.transform, Player.instance.GetHand(hand).transform, quickInventoryEquip, 0); return(true); } return(false); }
Vector2Int GetAlternativeSubmitsQT() { SteamVR_Input_Sources hand = VRManager.Int2Hand(inventoryUI.quickTradeInteractorID); if (QUICK_TRADE_SINGLE_TRADE_ACTION.GetStateDown(hand)) { return(new Vector2Int(InventoryUI.QUICK_TRADE_SINGLE_TRADE_ACTION, inventoryUI.quickTradeInteractorID)); } if (QUICK_TRADE_TRADE_ALL_ACTION.GetStateDown(hand)) { return(new Vector2Int(InventoryUI.QUICK_TRADE_TRADE_ALL_ACTION, inventoryUI.quickTradeInteractorID)); } if (QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION.GetStateDown(hand)) { return(new Vector2Int(InventoryUI.QUICK_TRADE_SWITCH_TO_FULL_TRADE_ACTION, inventoryUI.quickTradeInteractorID)); } return(new Vector2Int(-1, 1)); }
public void GetInputActionInfo(SteamVR_Action_Boolean action, out ButtonState[] buttonStates) { buttonStates = new ButtonState[] { ButtonState.None, ButtonState.None }; for (int i = 0; i < 2; i++) { SteamVR_Input_Sources hand = VRManager.Int2Hand(i); if (action.GetStateDown(hand)) { buttonStates[i] = ButtonState.Down; } else if (action.GetStateUp(hand)) { buttonStates[i] = ButtonState.Up; } else if (action.GetState(hand)) { buttonStates[i] = ButtonState.Held; } } }
void UpdateClimbs() { InteractionSystem.Interactor interactor = GetComponent <InteractionSystem.Interactor>(); climbables[0] = interactor.HasTag("ClimbRight"); climbables[1] = interactor.HasTag("ClimbLeft"); bool justLetGo = false; // foreach (var hand in climbableChecks.Keys) { for (int hand = 0; hand < 2; hand++) { SteamVR_Input_Sources handVR = VRManager.Int2Hand(hand); // bool isClimbable = climbableChecks[hand].isClimbable; bool isClimbable = climbables[hand]; // if we just clicked to start climbing, make this the primary climb hand if (isClimbable && climbAction.GetStateDown(handVR)) { SetHandClimb(handVR); } //if this is the current climbing hand if (isClimbing && currentClimbHand == handVR) { // if we've let go to stop climbing if (!isClimbable || climbAction.GetStateUp(handVR)) { isClimbing = false; justLetGo = true; //check if our other hand is climbable and gripping (so we make that the primary one again) SteamVR_Input_Sources otherHand = VRManager.OtherHand(handVR); if (climbables[VRManager.Hand2Int(otherHand)] && climbAction.GetState(otherHand)) { justLetGo = false; SetHandClimb(otherHand); } } } } /* * Assumes the open equip button is the side button * as well as teh teleport button */ Teleport.instance.teleportationAllowed = !isClimbing && !Player.instance.handsTogether; moveScript.useRawMovement = isClimbing; if (isClimbing) { Vector3 handLocalPosition = Player.instance.GetHand(currentClimbHand).transform.localPosition; moveScript.SetInputMoveVector(previousHandPosition - handLocalPosition); previousHandPosition = handLocalPosition; } else { if (justLetGo) { Vector3 momentum = previousHandPosition - (Player.instance.GetHand(currentClimbHand).transform.localPosition); moveScript.SetMomentum(momentum.MultiplyBy(climbExitForceMultiplier) ); } } }
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; } }