/// <summary> /// Drops the item, removing it from the inventory and potentially spawning an item on the ground near the character /// </summary> /// <param name="item">Item.</param> /// <param name="index">Index.</param> /// <param name="slot">Slot.</param> public virtual void DropItem(InventoryItem item, int index, InventorySlot slot = null) { if (InventoryItem.IsNull(item)) { MMEventManager.TriggerEvent(new MMInventoryEvent(MMInventoryEventType.Error, slot, this.name, null, 0, index)); return; } item.SpawnPrefab(); item.UnEquip(); DestroyItem(index); }
/// <summary> /// Drops the item, removing it from the inventory and potentially spawning an item on the ground near the character /// </summary> /// <param name="item">Item.</param> /// <param name="index">Index.</param> /// <param name="slot">Slot.</param> public virtual void DropItem(InventoryItem item, int index, InventorySlot slot = null) { if (InventoryItem.IsNull(item)) { MMInventoryEvent.Trigger(MMInventoryEventType.Error, slot, this.name, null, 0, index); return; } item.SpawnPrefab(); if (this.name == item.TargetEquipmentInventoryName) { if (item.UnEquip()) { DestroyItem(index); } } else { DestroyItem(index); } }