public void OnItemClicked() { ItemDragHandler dragHandler = gameObject.transform.parent.gameObject.transform.Find("Item").GetComponent<ItemDragHandler>(); IInventoryItem item = dragHandler.Item; item.OnDelete(trans); inventory.RemoveItem(item); }
public void RemoveItem(IInventoryItem item) { if (mItems.Remove(item)) { mItems.Remove(item); item.OnDelete(gameObject.transform); Collider collider = (item as MonoBehaviour).GetComponent <Collider>(); if (collider != null) { collider.enabled = true; } if (ItemRemoved != null) { ItemRemoved(this, new InventoryEventArgs(item)); } } }