Exemplo n.º 1
0
        public void OnPointerClick(PointerEventData eventData)
        {
            if (eventData != null && eventData.button == PointerEventData.InputButton.Left)
            {
                SetItem(GameCursor.HoldItem(itemData));
            }

            if (eventData != null && eventData.button == PointerEventData.InputButton.Right)
            {
                if (itemData != null && itemData.item != null)
                {
                    SetItem(GameCursor.HoldItem(itemData, 1));
                }
            }
        }
Exemplo n.º 2
0
        public void OnClick()
        {
            EquippableItem eqp = null;

            if (GameCursor.instance.heldItem == null)
            {
                if (item != null)
                {
                    GameCursor.HoldItem(new ItemData(item, 1));
                    item.Unequip(GameManager.instance.player.GetComponent <Player>());
                }

                SetItem(null);
            }

            else if (GameCursor.instance.heldItem.item is EquippableItem)
            {
                eqp = (EquippableItem)GameCursor.instance.heldItem.item;
                if (eqp.gearType != gearType)
                {
                    return;
                }

                if (item == null)
                {
                    GameCursor.HoldItem(null);
                }
                else
                {
                    GameCursor.HoldItem(new ItemData(item, 1));
                }

                SetItem(eqp);
                eqp.Equip(GameManager.instance.player.GetComponent <Player>());
            }
        }