public void OnPointerDown(PointerEventData data)
{
if (inventory != null)
{
if (item.Type < 6)
{ //item is equippable
string s = Enum.GetName(typeof(ItemType), item.Type);
if (inventory.equipSlots[item.Type] == null)
{
GameObject inventoryItem = this.gameObject;
inventory.equipSlots[item.Type] = inventoryItem;
GameObject charSlot = inventory.charPanel.transform.GetChild(0).GetChild(item.Type).gameObject;
inventoryItem.transform.SetParent(charSlot.transform);
inventoryItem.GetComponent <RectTransform>().localPosition = Vector3.zero;
Debug.Log("Item Equipped");
}
inventory.EquipItem(item);
}
if (item.Type == 6)
{ //item is consumable
int amount;
inventory.ConsumeItem(item);
amount = inventory.RemoveItem(item);
if (amount == 0)
{
Destroy(gameObject);
}
}
}
}