Ejemplo n.º 1
0
        internal void SetCurrentInventory(Inventory newInventory)
        {
            Inventory oldInventory = this.CurrentInventory;

            this.CurrentInventory = newInventory;

            if (newInventory != oldInventory && oldInventory != null)
            {
                RemovedFromInventory?.Invoke(oldInventory);
            }

            if (newInventory != oldInventory && newInventory != null)
            {
                AddedToInventory?.Invoke(newInventory);
            }
        }
Ejemplo n.º 2
0
    public bool Remove(ItemInfo item)
    {
        bool removed = Utils.RemoveItemFromList(items, item);

        if (removed)
        {
            if (item.categories.Contains(Category.baseMaterial))
            {
                Utils.RemoveItemFromList(baseMaterials, item);
            }

            if (item is IUsableItem)
            {
                Utils.RemoveItemFromList(usableItems, item);
            }

            if (item.categories.Contains(Category.healing))
            {
                Utils.RemoveItemFromList(healingItems, item);
            }

            if (item.categories.Contains(Category.ammo))
            {
                Utils.RemoveItemFromList(ammo, item);
            }

            if (item.categories.Contains(Category.machine))
            {
                Utils.RemoveItemFromList(machineItems, item);
            }

            RemovedFromInventory.Invoke(item);
        }

        return(removed);
    }