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