public static void ExchangeItemForCurrency(GearSlot gearSlot, InventoryObject sellerInv, CurrencyObject mainCurrency) { EquipmentObject eq = gearSlot.gear; int itemPrice = eq.SellPrice; mainCurrency.IncreaseAmount(itemPrice); sellerInv.RemoveGear(gearSlot); Debug.Log("Item sold"); }
public static void TradeItem(GearSlot gearSlot, InventoryObject buyerInv, InventoryObject sellerInv) { EquipmentObject eq = gearSlot.gear; int itemPrice = eq.BuyPrice; if (ExchangeMainCurrency(itemPrice, buyerInv, sellerInv)) { buyerInv.AddGear(eq); Debug.Log("You acquired an item: " + eq); sellerInv.RemoveGear(gearSlot); } else { Debug.Log("Trade failed."); } }