Skip to content

Commit

Permalink
Fixed upgrade purchasing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasQTruong committed May 16, 2024
1 parent baef0c6 commit 24f5308
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Assets/Game/Prefabs/Towers/Eger.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,17 @@ MonoBehaviour:
- MAX_LEVEL: 3
upgradeType: 0
value: 1
price: 400
price: 350
priceScaling: 1.5
- MAX_LEVEL: 3
upgradeType: 1
value: 0.75
value: 0.5
price: 400
priceScaling: 1.5
- MAX_LEVEL: 3
upgradeType: 2
value: 0.5
price: 300
price: 250
priceScaling: 1.25
- MAX_LEVEL: 3
upgradeType: 3
Expand Down
4 changes: 4 additions & 0 deletions Assets/Game/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ public void UpgradeTower(Upgrade upgrade) {
break;
case UpgradeType.Fire_Rate:
tower.fireCooldown -= (upgrade.value * tower.fireCooldown);
// Cap cooldown to 0.1.
if (tower.fireCooldown < 0.1f) {
tower.fireCooldown = 0.1f;
}
break;
case UpgradeType.Range:
tower.range += upgrade.value;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Game/Scripts/UpgradeButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public void UpgradeLevel() {
}

// Can afford and upgrade; proceed with upgrading.
upgrade.UpgradeLevel();
GameManager.instance.money -= upgrade.price;
upgrade.UpgradeLevel();
GameUIManager.instance.UpgradedTower(upgrade);
UpdatePrice();
GameManager.instance.UpgradeTower(upgrade);
Expand Down
Binary file modified Builds/WebGL/Build/WebGL.data
Binary file not shown.
Binary file modified Builds/WebGL/Build/WebGL.wasm
Binary file not shown.

0 comments on commit 24f5308

Please sign in to comment.