/// <summary>
 /// Registers a new item slot with the inventory.
 /// </summary>
 /// <param name="newItemSlot">The item slot to add to this inventory.</param>
 /// <param name="name">The name of the item to associate with the specified slot.</param>
 public void RegisterItemSlot(InventoryItemSlot newItemSlot, string name)
 {
     if (!HasItemSlot(name))
     {
         newItemSlot.Container = this;
         _itemSlots.Add(name, newItemSlot);
     }
 }
 /// <summary>
 /// Callback called when the collection of an item would take the inventory over its weight limit.
 /// </summary>
 /// <param name="itemSlot">The item whos collectoin would brought the container over its weight capacity.</param>
 /// <param name="amount">The amount of the item in question.</param>
 /// <returns>True if collecting the specified amount of the specified item should be allowed.</returns>
 protected virtual bool _onWeightCapacityReached(InventoryItemSlot itemSlot, int amount)
 {
     return false;
 }
        /// <summary>
        /// Returns whether or not the specified amount of the specified item would take the inventory over its weight limit if added.
        /// </summary>
        /// <param name="itemSlot">The item slot to check.</param>
        /// <param name="amount">The amount of the item to check.</param>
        /// <returns>True if there is room in the inventory for the specified amount of the specified item.</returns>
        public bool CanCarryMore(InventoryItemSlot itemSlot, int amount)
        {
            if (itemSlot == null)
                return false;

            if (itemSlot.Count + amount > itemSlot.MaxCount)
                return itemSlot.OnMaxCountReached(amount);

            if (itemSlot.WeighByCount)
            {
                if (TotalWeight + ((itemSlot.Count + amount) * itemSlot.Weight) < WeightCapacity)
                    return _onWeightCapacityReached(itemSlot, amount);
            }
            else if (itemSlot.NotEmpty || TotalWeight + itemSlot.Weight < WeightCapacity)
            {
                return true;
            }
            else
            {
                return _onWeightCapacityReached(itemSlot, amount);
            }

            return false;
        }