示例#1
0
        public new void RemoveAt(int index)
        {
            var e = base[index];

            base.RemoveAt(index);
            ItemRemove?.Invoke(e, index);
        }
示例#2
0
        public virtual bool Remove(TItem item)
        {
            var result = _Items.Remove(item);

            if (result)
            {
                //var handlers = ItemRemove;
                //if (handlers != null)
                //    handlers(item);

                ItemRemove?.Invoke(item);
            }

            return(result);
        }
示例#3
0
    //Removes the item from the inventory list then drops the item. Turns on colliders to make it the same as it was before. Activating the object in the view
    public void RemoveItem(TheInventoryItem item)
    {
        //Debug.Log("This is the remove item");
        if (myItems.Contains(item))
        {
            myItems.Remove(item);

            item.OnDrop();

            //Debug.Log("This is the ondrop");
            Collider collider = (item as MonoBehaviour).GetComponent <Collider>();
            if (collider != null)
            {
                collider.enabled = true;
            }

            ItemRemove?.Invoke(this, new InventoryEventArgs(item));
        }
    }