Esempio n. 1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        InventoryWindow inventoryWindow = GameObject.Find("InventoryWindow").GetComponent <InventoryWindow>();

        if (inventoryWindow.dragged)
        {
            if (this.name != "Empty")
            {
                inventoryWindow.SwapItem(this.gameObject);
            }
            else
            {
                this.transform.name = inventoryWindow.AddItemToSlot(this.gameObject);
                this.transform.GetChild(0).gameObject.SetActive(true);
            }
        }
    }
Esempio n. 2
0
    public void OnPointerDown(PointerEventData eventData)
    {
        InventoryWindow inventoryWindow = GameObject.Find("InventoryWindow").GetComponent <InventoryWindow>();

        if (inventoryWindow.dragged)
        {
            if (this.name != "Empty")
            {
                inventoryWindow.SwapItem(this.gameObject);
            }
            else
            {
                this.transform.name = inventoryWindow.AddItemToSlot(this.gameObject);
                this.transform.GetChild(0).gameObject.SetActive(true);
                string v = InventoryWindow.playerInventory[System.Int32.Parse(this.gameObject.name)].ItemName;
                itemsAdded(v);
                InventoryWindow.itemCounter.Add(v);
            }
        }
    }