Added upgrade descriptions to upgrader

This commit is contained in:
SpoodyTheOne 2024-02-04 02:45:51 +01:00
parent b1e67478f6
commit 6517c26fc3
1 changed files with 29 additions and 11 deletions

View File

@ -1,4 +1,5 @@
using System.Collections; using System.Collections;
using TMPro;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine; using UnityEngine;
@ -59,6 +60,7 @@ public class Upgrader : MonoBehaviour
private bool prevCouldUpgrade = true; private bool prevCouldUpgrade = true;
public Image BloodMeter; public Image BloodMeter;
public TMPro.TextMeshPro description;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -179,6 +181,8 @@ public class Upgrader : MonoBehaviour
} }
else else
{ {
description.text = "";
if (acceptTime > 0f) if (acceptTime > 0f)
{ {
foreach (Image i in upgradeImages) foreach (Image i in upgradeImages)
@ -194,14 +198,18 @@ public class Upgrader : MonoBehaviour
} }
else if (prevCouldUpgrade) else if (prevCouldUpgrade)
{ {
background.color = Color.gray; // TODO: PLAY SOUND HERE!!
foreach (Image i in upgradeImages)
{
i.color = Color.gray;
}
Player1Cursor.gameObject.SetActive(false); description.text = "";
Player2Cursor.gameObject.SetActive(false); background.color = Color.gray;
foreach (Image i in upgradeImages)
{
i.color = Color.gray;
i.gameObject.transform.localScale = Vector3.one;
}
Player1Cursor.gameObject.SetActive(false);
Player2Cursor.gameObject.SetActive(false);
} }
Player1Cursor.localPosition = Player1Input.look.normalized * (125 - 12); Player1Cursor.localPosition = Player1Input.look.normalized * (125 - 12);
@ -213,6 +221,7 @@ public class Upgrader : MonoBehaviour
/// Increases mop radius by 10% /// Increases mop radius by 10%
public void UpgradeMopSize() public void UpgradeMopSize()
{ {
description.text = upgrades.mopUpgrade.name;
bloodManager.CleanRadius *= mopSizeIncrease; bloodManager.CleanRadius *= mopSizeIncrease;
upgrades.mopUpgrade.amount++; upgrades.mopUpgrade.amount++;
} }
@ -220,6 +229,7 @@ public class Upgrader : MonoBehaviour
/// Increases move speed by 10% /// Increases move speed by 10%
public void UpgradeSpeed() public void UpgradeSpeed()
{ {
description.text = upgrades.speedUpgrade.name;
player1.GetComponent<PlayerMovement>().moveSpeed *= speedIncrease; player1.GetComponent<PlayerMovement>().moveSpeed *= speedIncrease;
player2.GetComponent<PlayerMovement>().moveSpeed *= speedIncrease; player2.GetComponent<PlayerMovement>().moveSpeed *= speedIncrease;
upgrades.speedUpgrade.amount++; upgrades.speedUpgrade.amount++;
@ -228,12 +238,15 @@ public class Upgrader : MonoBehaviour
public void RopeUpgrade() public void RopeUpgrade()
{ {
// todo: public methods // todo: public methods
description.text = upgrades.ropeUpgrade.name;
rope.ropeMaxLength *= ropeIncrease; rope.ropeMaxLength *= ropeIncrease;
upgrades.ropeUpgrade.amount++; upgrades.ropeUpgrade.amount++;
} }
public void HealthUpgrade() public void HealthUpgrade()
{ {
description.text = upgrades.healthUpgrade.name;
var comp1 = player1.GetComponent<HealthComponent>(); var comp1 = player1.GetComponent<HealthComponent>();
comp1.setMaxHealth((int)(comp1.getMaxHealth() * healthIncrease)); comp1.setMaxHealth((int)(comp1.getMaxHealth() * healthIncrease));
@ -244,6 +257,7 @@ public class Upgrader : MonoBehaviour
public void DamageUpgrade() public void DamageUpgrade()
{ {
description.text = upgrades.damageUpgrade.name;
// todo: public rope methods // todo: public rope methods
// rope.da // rope.da
upgrades.damageUpgrade.amount++; upgrades.damageUpgrade.amount++;
@ -251,6 +265,7 @@ public class Upgrader : MonoBehaviour
public void BloodUpgrade() public void BloodUpgrade()
{ {
description.text = upgrades.bloodUpgrade.name;
bloodManager.scoreMult *= bloodIncrease; bloodManager.scoreMult *= bloodIncrease;
upgrades.bloodUpgrade.amount++; upgrades.bloodUpgrade.amount++;
} }
@ -258,17 +273,20 @@ public class Upgrader : MonoBehaviour
public void ReelUpgrade() public void ReelUpgrade()
{ {
// todo rope methods // todo rope methods
description.text = upgrades.reelUpgrade.name;
rope.ropeExtendSpeed *= reelIncrease; rope.ropeExtendSpeed *= reelIncrease;
upgrades.reelUpgrade.amount++; upgrades.reelUpgrade.amount++;
} }
IEnumerator updateBloodMeter() { IEnumerator updateBloodMeter()
while (true) { {
while (true)
{
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
BloodMeter.fillAmount = ((float)bloodManager.score)/((float)upgradeCost); BloodMeter.fillAmount = ((float)bloodManager.score) / ((float)upgradeCost);
} }
// dont care // dont care
yield return null; yield return null;
} }