Esempio n. 1
0
    public void MousePutDownOnActionBar(ActionBarSlot slot)
    {
        if (airItem == null)
        {
            return;
        }
        if (!(airItem.item is UsableItem))
        {
            airItem = null;
            return;
        }
        GameObject newGo = Instantiate(airItem.gameObject, slot.transform.position, Quaternion.identity, slot.transform.GetChild(0));

        slot.copiedItem   = newGo;
        slot.originalItem = airItem;
        slot.usableItem   = airItem.item;
        newGo.GetComponent <ItemUI>().onActionBar   = true;
        newGo.GetComponent <ItemUI>().actionBarSlot = slot;
        newGo.GetComponent <ItemUI>().SetPointer(airItem);
        newGo.GetComponent <Image>().sprite = airItem.item.inventoryIcon;
        if (airItem.onActionBar)
        {
            slot.originalItem = airItem.transform.parent.parent.GetComponent <ActionBarSlot>().originalItem;
            newGo.GetComponent <ItemUI>().SetPointer(airItem.GetPointer());
            newGo.GetComponent <Image>().sprite = airItem.GetPointer().item.inventoryIcon;
            Destroy(airItem.gameObject);
        }
        airItem = null;
    }