void UpdateInteractorReferenceTransform() { if (interactor.referenceTransform == null) { interactor.referenceTransform = new GameObject(name + " interactor helper transform").transform; } TransformBehavior.AdjustTransform(interactor.referenceTransform, transform, interactorReferenceBehavior, 0); }
public static void AdjustTransform(Transform transform, TransformBehavior equipBehavior, int settingIndex, Vector3 multiplier) { if (transform == null) { Debug.LogWarning("cant adjust, transform is null"); return; } if (equipBehavior == null) { Debug.LogWarning("Cant move :: " + transform.name + " equip behavior is null"); return; } equipBehavior.AdjustTransform(transform, settingIndex, multiplier); }
void SnapItemToPosition(int equipSlot) { Transform itemTransform = equippedSlots[equipSlot].sceneItem.transform; ItemBehavior item = equippedSlots[equipSlot].item; Transform oldParent = itemTransform.parent; TransformBehavior.AdjustTransform(itemTransform, equipPoints[equipSlot].transform, item.equipTransform, equipSlot); if (item.equipType != EquipType.Normal) { itemTransform.parent = oldParent; } }
void AdjustHints() { Vector3 textOffset = rightHand[0].textOffset; for (int i = 0; i < rightHand.Length; i++) { HintUIElement re = rightHand[i]; ControllerHintUIElement rElement = re.element; rElement.transform.localScale = Vector3.one * hintScale; rElement.text.transform.localScale = Vector3.one * textScale; rElement.text.transform.localPosition = textOffset;//rightHand[i].textOffset; TransformBehavior.AdjustTransform(rElement.transform, Player.instance.rightHand.transform, hintTransforms, i); leftHand[i].element.transform.localScale = Vector3.one * hintScale; leftHand[i].element.text.transform.localScale = Vector3.one * textScale; leftHand[i].element.text.transform.localPosition = textOffset;//leftHand[i].textOffset; TransformBehavior.AdjustTransform(leftHand[i].element.transform, Player.instance.leftHand.transform, hintTransforms, i, new Vector3(-1, 1, 1)); } }
void FixedUpdate() { if (equipID < 0 || equipID >= baseInventory.equippedSlots.Length) { Debug.LogError("Equip slot " + equipID + " is out of range on inventory " + baseInventory); return; } Inventory.InventorySlot slot = baseInventory.equippedSlots[equipID]; if (slot != null) { ItemBehavior item = slot.item; if (item.equipType == Inventory.EquipType.Physics) { UpdateAttachedVelocity(slot); } else if (item.equipType == Inventory.EquipType.Normal) { TransformBehavior.AdjustTransform(slot.sceneItem.transform, transform, item.equipTransform, equipID); } } }
void SetUpMessageCenter() { Transform handTransform = Player.instance.GetHand(messagesHand).transform; TransformBehavior.AdjustTransform(messageCenter.transform, handTransform, messagesEquip, 0); }
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; } }