Undo last purchase working again

Added Comments to AnimalShop, ItemShop and ShopUI classes
This commit is contained in:
d-hain 2022-06-23 22:24:22 +02:00
parent 441ffb900a
commit c01c592976
7 changed files with 25 additions and 194 deletions

View file

@ -1,8 +1,6 @@
using UnityEngine;
namespace Shop {
public class ItemShop : ElementStorage<Item> {
#region Singleton
@ -26,8 +24,8 @@ namespace Shop {
private int _lastBoughtItemAmount;
/**
* Calls ElementStorage.RemoveItem() and sets 2 Variables to remember the last bought item
*/
* Calls ElementStorage.RemoveItem() and sets 2 Variables to remember the last bought item
*/
public override void RemoveElement(Item item, int amount) {
base.RemoveElement(item, amount);
if(itemWasBought) {
@ -36,6 +34,9 @@ namespace Shop {
}
}
/**
* Undo the last purchase (refund money)
*/
public void UndoLastPurchase() {
if(itemWasBought) {
_inventory = Inventory.instance;