Exemplo n.º 1
0
 private void ActivateSlots(int capacity, ItemPickable[] item, StorageViewable storage)
 {
     Clear();
     for (int i = 0; i < capacity; i++)
     {
         InventorySlotManager Slot = transform.GetChild(i).gameObject.GetComponent <InventorySlotManager>();
         Slot.Active = true;
         Slot.GetComponent <RawImage>().color = Active_Color;
         if (item[i] != null)
         {
             GameObject itemObject = new GameObject();
             ItemSprite itemSprite = itemObject.AddComponent <ItemSprite>();
             RawImage   image      = itemObject.AddComponent <RawImage>();
             itemSprite.Reference = item[i].gameObject;
             itemSprite.Quantity  = item[i].Quantity;
             image.texture        = item[i].ItemIcon;
             image.SetNativeSize();
             itemObject.name = item[i].name;
             itemObject.transform.SetParent(Slot.transform, false);
             try {
                 item[i].gameObject.GetComponent <Collider>().enabled     = false;
                 item[i].gameObject.GetComponent <MeshRenderer>().enabled = false;
             }
             catch (Exception e) {
                 item[i].gameObject.SetActive(false);
             }
         }
     }
     CheckDropForInActive();
 }
Exemplo n.º 2
0
 private void Clear()
 {
     for (int i = 0; i < transform.childCount; i++)
     {
         InventorySlotManager Slot = transform.GetChild(i).gameObject.GetComponent <InventorySlotManager>();
         Slot.Active = false;
         Slot.GetComponent <RawImage>().color = InActive_Color;
     }
 }
Exemplo n.º 3
0
 public void Initialize()
 {
     Clear();
     for (int i = 0; i < UI.root.playerInventory.ActiveInventorySlots; i++)
     {
         InventorySlotManager Slot = transform.GetChild(i).gameObject.GetComponent <InventorySlotManager>();
         Slot.Active = true;
         Slot.GetComponent <RawImage>().color = Active_Color;
     }
     CheckDropForInActive();
 }
Exemplo n.º 4
0
 private void ActivateSlots(int ActiveInventorySlots)
 {
     Clear();
     for (int i = 0; i < ActiveInventorySlots; i++)
     {
         InventorySlotManager Slot = transform.GetChild(i).gameObject.GetComponent <InventorySlotManager>();
         Slot.Active = true;
         Slot.GetComponent <RawImage>().color = Active_Color;
     }
     CheckDropForInActive();
 }