Exemplo n.º 1
0
    public void AddItemToInventory(Item item)
    {
        ItemUI itemUI = ItemUI.CreateItemUIElement(item.name, item.image, item.quantity, ItemsGroupPanel.transform);

        itemUI.GetComponent <Button>().onClick.AddListener(() => SelectItem(item));
        items.Add(new ItemStruct(item, itemUI));
    }
Exemplo n.º 2
0
 private void Start()
 {
     inputMaster = GameManager.instance.inputMaster;
     if (!isPickup)
     {
         inventory.onAmmoChange += UpdateAmmoUI;
         for (int i = 0; i < Inventory.ammoTypesCount; i++)
         {
             ItemUI ammoItem = ItemUI.CreateItemUIElement(
                 System.Enum.GetNames(typeof(AmmoType))[i],
                 inventory.ammoSprites[i],
                 inventory.currentAmmo[i],
                 AmmoGroupPanel.transform
                 );
             ammoUI.Add(ammoItem);
         }
     }
 }