public void PerformAction(ShopModel shopModel) { if (shopModel.selectedItem == null) { return; } if (!shopModel.playerInventory.SpendMoney(shopModel.selectedItem.Price)) { Debug.Log("Item could not be purchased"); return; } Item previousItem = shopModel.SelectLastItem(); shopModel.shopInventory.TransferItem(previousItem, shopModel.playerInventory); }
public void PerformAction(ShopModel shopModel) { if (shopModel.selectedItem == null) { return; } //Debug.Log("item price is" + selectedItem.price); if (!shopModel.playerInventory.SpendMoney(-shopModel.selectedItem.SellPrice)) { Debug.Log("Item could not be sold"); return; } Item previousItem = shopModel.SelectLastItem(); shopModel.playerInventory.TransferItem(previousItem, shopModel.shopInventory); //onInventoryUpdate?.Invoke(); }