public bool RemoveItem(EquipableItem item, out List <Item> PreItems) { PreItems = null; var target = EquipmentSlots.FirstOrDefault(s => s.EquipmentType == item.EquipmentType); if (target.Item != null) { OnRemoveItemEvent?.Invoke(item); target.Amount = 0; target.Item = null; return(true); } //for (int i = 0; i < EquipmentSlots.Length; i++) //{ // if (EquipmentSlots[i].Item == item) // { // // CharacterScript.Instance.characterState.Remove(item.state); // //PlayerVisualScript.Instance.RemoveItemVisual(item); // OnRemoveItemEvent?.Invoke(item); // EquipmentSlots[i].Item = null; // return true; // } //} return(false); }
public void RemoveItem(EquipmentSlot item) { if (item.Item != null) { OnRemoveItemEvent?.Invoke((EquipableItem)item.Item); } item = null; }
public void RemoveItem(List <EquipmentSlot> slots) { foreach (var slot in slots) { if (slot.Item != null) { OnRemoveItemEvent?.Invoke((EquipableItem)slot.Item); } slot.Item = null; slot.Amount = 0; } }
public void RemoveItem(List <Item> items) { if (items.Count > 0) { foreach (var item in items) { if (item != null) { OnRemoveItemEvent?.Invoke((EquipableItem)item); } } } items = null; }