public void SellBackPurchasedItems(List <PurchasedItem> itemsToSell) { foreach (PurchasedItem item in itemsToSell) { var itemValue = GetBuyValueAtCurrentLocation(item); campaign.Map.CurrentLocation.StoreCurrentBalance -= itemValue; campaign.Money += itemValue; PurchasedItems.Remove(item); } }
public void SellBackPurchasedItems(List <PurchasedItem> itemsToSell) { // Check all the prices before starting the transaction // to make sure the modifiers stay the same for the whole transaction Dictionary <ItemPrefab, int> buyValues = GetBuyValuesAtCurrentLocation(itemsToSell.Select(i => i.ItemPrefab)); foreach (PurchasedItem item in itemsToSell) { var itemValue = item.Quantity * buyValues[item.ItemPrefab]; Location.StoreCurrentBalance -= itemValue; campaign.Money += itemValue; PurchasedItems.Remove(item); } }
private void RemoveItem(PurchasedItem item) { PurchasedItems.Remove(item); CartLines.Refresh(); UpdateView(); }