示例#1
0
        /**
         * <summary>Adds an inventory item to the Container's contents, at a particular index.</summary>
         * <param name = "itemInstance">The instance of the item to place within the Container</param>
         * <param name = "_index">The index number within the Container's current contents to insert the new item</param>
         * <param name = "count">If >0, the quantity of the item to be added. Otherwise, the same quantity as _item will be added</param>
         */
        public void InsertAt(InvInstance itemInstance, int index, int amountOverride = 0)
        {
            if (!InvInstance.IsValid(itemInstance))
            {
                return;
            }

            itemInstance.TransferCount = (amountOverride > 0) ? amountOverride : 0;
            invCollection.Insert(itemInstance, index);
        }