public bool RemoveItems(ItemScript item, int quantity = 1)
    {
        bool hadRequestedNumber = ContainsItem(item, quantity);

        EquipmentItemToQuantity collection = ItemTypeToDictionary(item);

        if (collection != null)
        {
            collection[item] -= quantity;
        }

        return(hadRequestedNumber);
    }
    public bool ContainsItem(ItemScript item, int quantity = 1)
    {
        bool result = false;
        EquipmentItemToQuantity collection = ItemTypeToDictionary(item);

        if (collection != null)
        {
            string key = EquipmentItemToQuantity.ItemToDictionaryKey(item);
            result = collection.ContainsKey(key) && collection[key] >= quantity;
        }

        return(result);
    }
    void Awake()
    {
        if (ItemsDictionary == null || ItemsDictionary.Count == 0)
        {
            ItemScript[] allItems = Resources.LoadAll <ItemScript>("Items");
            ItemsDictionary = new Dictionary <string, ItemScript>();

            foreach (ItemScript item in allItems)
            {
                //Debug.Log(item.Name);
                ItemsDictionary.Add(EquipmentItemToQuantity.ItemToDictionaryKey(item), item);
            }
        }
    }
    private void GetCollectionsList(EquipmentItemToQuantity collection, out ItemScript[] items, out int[] quantities)
    {
        items      = new ItemScript[collection.Count];
        quantities = new int[collection.Count];

        string[] keys = new string[collection.Count];
        collection.Keys.CopyTo(keys, 0);

        int i = 0;

        foreach (string key in keys)
        {
            items[i]      = ItemsDictionary[key];
            quantities[i] = collection[key];
            i++;
        }
    }
    public EquipmentItemToQuantity ItemTypeToDictionary(ItemScript item)
    {
        EquipmentItemToQuantity result = null;

        if (item.IsWeapon)
        {
            result = Weapons;
        }
        if (item.IsQuestItem)
        {
            result = QuestItems;
        }
        if (item.IsConsumable)
        {
            result = Consumables;
        }

        return(result);
    }