protected override bool OnControllerInteraction(VRInteraction.InteractionEvent action, GameObject interactable, HandManager hand) { /* Was this action a trigger press? */ if (action != VRInteraction.InteractionEvent.OnTriggerPressed) { return(false); } /* Get the money manager from the interactable */ RelicCoinBag coinBag = interactable.GetComponent <RelicCoinBag>(); if (coinBag == null) { return(false); } ///* Let the money manager know they received a trigger click */ //RelicWithdrawInterface withdraw = coinBag.GetComponentInParent<RelicWithdrawInterface>(); //Debug.Assert(withdraw != null); ///* Let the withdraw interface know there was a click on the coin bag */ //withdraw.OnTriggerClick(hand, playerInventory.GetInventory()); /* We used this event */ return(true); }
public override bool IsCompatibleWithAction(VRInteraction.InteractionEvent action) { if (VRInteraction.ActionToType(action) == VRInteraction.InteractionType.Trigger) { return(true); } return(false); }
public override bool IsCompatibleWithAction(VRInteraction.InteractionEvent action) { return(action == VRInteraction.InteractionEvent.OnTriggerPressed); }
protected override bool OnControllerInteraction(VRInteraction.InteractionEvent action, GameObject interactable, HandManager hand) { /* Make sure our toolbelt is actually setup */ if (toolbelt == null) { return(false); } /* Is the interactable a toolbelt slot? */ PlayerToolbeltSlot slot = interactable.GetComponent <PlayerToolbeltSlot>(); if (slot == null || !slot.GetSocketManager().hasAuthority) { return(false); } /* This has to be a pickup action */ if (!SojournItem.IsPickupEvent(action)) { return(false); } if (debug) { Debug.Log("PlayerToolbeltManager Client: The player is attempting to pickup something from our toolbelt slot."); } /* The slot must be occupied */ if (!slot.IsOccupied()) { if (debug) { Debug.LogError("PlayerToolbeltManager Client: This toolbelt slot isn't occupied!"); } return(false); } /* Get the object that's in the slot we're interacting with */ GameObject toolbeltItemObj = slot.GetAttachedObject(); if (toolbeltItemObj == null) { throw new System.Exception("Why is there no attached item if this slot is occupied?"); } /* Convert the object to an item */ SojournItem toolbeltItem = toolbeltItemObj.GetComponent <SojournItem>(); if (toolbeltItem == null) { throw new System.Exception("Why is this object attached to the toolbelt but it's not an item!!"); } /* If the hand isn't empty, swap the items */ if (hand.IsHoldingSomething()) { if (debug) { Debug.LogWarning("PlayerToolbeltManager Client: The player is already holding something so we'll swap items"); } /* We have to do the swap on the server */ //CmdSwapItems(hand.netId, slot.GetSocketManager().netId, slot.socketNumber); /* We swapped items */ return(true); } if (debug) { Debug.Log("PlayerToolbeltManager Client: We weren't holding something, so we're just picking up the object"); } /* Pickup the item from the toolbelt */ CmdPickupItem(hand.netId, slot.GetSocketManager().netId, slot.GetSocketNumber()); /* We picked up the object */ return(true); }