Esempio n. 1
0
    //to be used in serialization process
    public void GenerateItemInEq(Item item, int upgradeLvl)
    {
        EqPieceSlot slot   = myUI.GetEqPieceSlotByEqPiece(((EquippableItem)item).eqPiece);
        GameObject  prefab = GetApropriatePrefab(item);
        GameObject  newGo  = Instantiate(prefab, slot.slot1.transform.position, Quaternion.identity, itemsGO.transform);

        newGo.GetComponent <ItemUI>().inventory    = this;
        newGo.GetComponent <ItemUI>().item         = item;
        newGo.GetComponent <ItemUI>().UpgradeLevel = upgradeLvl;
        newGo.GetComponent <ItemUI>().itemX        = -1;
        newGo.GetComponent <ItemUI>().itemY        = -1;
        newGo.GetComponent <ItemUI>().eqPieceSlot  = slot;
        newGo.GetComponent <Image>().sprite        = item.inventoryIcon;
        slot.item   = item;
        slot.itemUI = newGo.GetComponent <ItemUI>();
    }
Esempio n. 2
0
 private void Start()
 {
     parentEqPieceSlot = transform.parent.GetComponent <EqPieceSlot>();
 }