you can now undo a purchase after buying an item from the shop

This commit is contained in:
d-hain 2022-06-08 21:47:00 +02:00
parent efc7a3deaf
commit 64b25a2029
12 changed files with 359 additions and 56 deletions

View file

@ -32,13 +32,14 @@ public class ShopSlot : ItemStorageSlot {
public override void UseItem() {
if(Item) {
if(_playerController.Money >= Item.cost) {
_inventory.AddItem(Item, 1);
_shop.RemoveItem(Item, 1);
if(Item) {
_playerController.ChangeMoney(-Item.cost);
_shop.itemWasBought = true;
Debug.Log("Buying Item: " + Item.displayName);
}
_inventory.AddItem(Item, 1);
_shop.RemoveItem(Item, 1);
} else {
Debug.Log("Not enough money to buy item.");
}