Example #1
0
 public void Initialise(InventoryTab inventoryUI, Storage inventory, int id)
 {
     this.inventoryUI = inventoryUI;
     Inventory        = inventory;
     ID = id;
     SetStack(inventory.ItemStacks[id]);
     Inventory.OnStackUpdated += UpdateStack;
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
 }
Example #3
0
        public void Initialise(InventoryTab uiController, Storage inv)
        {
            inventoryUI = uiController;
            inventory   = inv;

            foreach (Transform child in transform)
            {
                Destroy(child.gameObject);
            }

            for (int i = 0; i < inv.ItemStacks.Count; i++)
            {
                Slot slot = Instantiate(slotPrefab, transform);
                slot.Initialise(inventoryUI, inventory, i);
                slots.Add(slot);
            }
        }