/// <summary> /// Checks if item can be equipped. Also equips it. /// </summary> /// <param name="item"></param> /// <param name="lastItem"></param> /// <returns></returns> public bool Equip(Item item, out Item lastItem) { if (inventory.RemoveItem(item)) { Item previousItem; if (equipments.AddItem(item, out previousItem)) { if (previousItem != null) { previousItem.isEquipped = false; inventory.AddItem(previousItem); } item.isEquipped = true; lastItem = previousItem; return(true); } else { inventory.AddItem(item); } } lastItem = null; return(false); }