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

@ -4,7 +4,6 @@ using UnityEngine;
public class ShopUI : MonoBehaviour {
public Transform itemsParent;
public GameObject shopUI;
public bool shopIsOpen;
public GameObject inventoryUI;
private Shop _shop;
@ -17,7 +16,6 @@ public class ShopUI : MonoBehaviour {
// Add all ShopSlot GameObjects to _slots and turn off the Shop UI
_slots = itemsParent.GetComponentsInChildren<ShopSlot>();
shopIsOpen = false;
ToggleShop();
// Set the icon to not be a raycast target for the Description Hovering to work
@ -29,7 +27,6 @@ public class ShopUI : MonoBehaviour {
private void Update() {
// When "Shop" button is pressed turn on/off Shop UI
if (Input.GetButtonDown("Shop")) {
shopIsOpen = true;
ToggleShop();
}
}
@ -38,7 +35,7 @@ public class ShopUI : MonoBehaviour {
* Turn on/off the Shop UI
*/
private void ToggleShop() {
inventoryUI.gameObject.SetActive(!shopUI.activeSelf);
// TODO: geht ned oda so: inventoryUI.gameObject.SetActive(!shopUI.activeSelf);
shopUI.SetActive(!shopUI.activeSelf);
}