you can now undo a purchase after buying an item from the shop
This commit is contained in:
parent
efc7a3deaf
commit
64b25a2029
12 changed files with 359 additions and 56 deletions
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue