Exemplo n.º 1
0
        internal void AddItem(ItemEntity item, ItemDescription container)
        {
            Items.Add(item);

            if (container.HideContent)
            {
                item.gameObject.SetActive(false);
            }
            else
            {
                item.transform.position = Slots[GetFreeSlot()].transform.position;
                ItemSlotIndex.Add(item, GetFreeSlot());
                SlotsAvailable[ItemSlotIndex[item]] = false;
            }

            EmptySlots -= item.Description.ContentSize;
        }
Exemplo n.º 2
0
        internal bool RemoveItem(ItemEntity item)
        {
            if (!Items.Contains(item))
            {
                Debug.LogError("The given item is not a content of this container");
                return(false);
            }

            SlotsAvailable[ItemSlotIndex[item]] = true;

            Items.Remove(item);

            ItemSlotIndex.Remove(item);

            item.gameObject.SetActive(true);

            EmptySlots += item.Description.ContentSize;

            return(true);
        }