Made the shop upgrades work

Click a shop upgrade to change its respective value and start a new wave
This commit is contained in:
2024-10-20 20:28:27 -07:00
parent 256b9ba569
commit 4a0eee9c38
5 changed files with 162 additions and 22 deletions

View File

@@ -3,7 +3,7 @@ using UnityEngine;
public class GameState : MonoBehaviour
{
public string state;
public uint wave = 1;
public uint wave;
public GameObject ratbot;
public GameObject shop;
void Start() {
@@ -14,18 +14,16 @@ public class GameState : MonoBehaviour
void Update()
{
if (GameObject.FindGameObjectsWithTag("Ratbot").Length == 0 && state == "WAVE") {
NewWave();
OpenShop();
}
}
void OpenShop() {
state = "SHOP";
Instantiate(shop);
}
void CloseShop() {
Destroy(GameObject.FindGameObjectWithTag("Shop"));
NewWave();
}
public void NewWave() {
// Close the shop
Destroy(GameObject.FindGameObjectWithTag("Shop"));
// Spawn ratbots around the player
// Amount, health, and damage scale with waves
state = "WAVE";