public void OnClick() { //If shift is pressed, don't check anything, just send Examine on contained item if any. if (KeyboardInputManager.IsShiftPressed() && itemSlot.Item != null) { RequestExamineMessage.Send(itemSlot.Item.GetComponent<NetworkIdentity>().netId); return; } SoundManager.Play(SingletonSOSounds.Instance.Click01); //if there is an item in this slot, try interacting. if (itemSlot.Item != null) { itemSlot.TryItemInteract(); } //otherwise, try switching hands to this hand if this is our own hand slot and not already active else if (itemSlot == UIManager.Hands.LeftHand && UIManager.Hands.CurrentSlot != itemSlot) { UIManager.Hands.SetHand(false); } else if (itemSlot == UIManager.Hands.RightHand && UIManager.Hands.CurrentSlot != itemSlot) { UIManager.Hands.SetHand(true); } else { //otherwise, try just interacting with the blank slot (which will transfer the item itemSlot.TryItemInteract(); } }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { SoundManager.Play("Click01"); itemSlot.TryItemInteract(); } }
/// <summary> /// General function to activate the item's UIInteract /// This is the same as clicking the item with the same item's hand /// </summary> public void Activate() { if (!IsValidPlayer()) { return; } // Is there an item in the active hand? if (CurrentSlot.Item == null) { return; } CurrentSlot.TryItemInteract(); }
public void OnClick() { SoundManager.Play("Click01"); //if there is an item in this slot, try interacting. if (itemSlot.Item != null) { itemSlot.TryItemInteract(); } //otherwise, try switching hands to this hand if this is a hand slot and not already active else if (itemSlot.ItemSlot.NamedSlot == NamedSlot.leftHand && UIManager.Hands.CurrentSlot != itemSlot) { UIManager.Hands.SetHand(false); } else if (itemSlot.ItemSlot.NamedSlot == NamedSlot.rightHand && UIManager.Hands.CurrentSlot != itemSlot) { UIManager.Hands.SetHand(true); } else { //otherwise, try just interacting with the blank slot (which will transfer the item itemSlot.TryItemInteract(); } }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { SoundManager.Play("Click01"); // Only try interacting if we're not actually switching hands if (UIManager.Hands.hasSwitchedHands) { UIManager.Hands.hasSwitchedHands = false; } else { itemSlot.TryItemInteract(); } } }