TO SQUASH: Multiplier label.

This commit is contained in:
2026-08-26 22:53:17 -04:00
parent 37c802978b
commit afbef6c389
9 changed files with 314 additions and 22 deletions
+8 -2
View File
@@ -48,6 +48,8 @@ public class Player : MonoBehaviour
public int bonus = 3100;
public float speedBonus = 0.25f;
public Animator gunAnimator;
public Animator muzzleAnimator;
@@ -60,8 +62,6 @@ public class Player : MonoBehaviour
public int laserCount = 0;
public float barPower = 0f;
public GameObject magnetLeft;
public GameObject magnetRight;
@@ -528,6 +528,12 @@ public class Player : MonoBehaviour
}
canFire = true; // Allow firing again after bar hit.
speedBonus -= 0.05f; // Decrease speed bonus on bar hit.
if (speedBonus < 0.0f)
{
speedBonus = 0.0f; // Clamp to minimum value.
}
}
void OnCollisionEnter2D(Collision2D collision)
+14
View File
@@ -1,5 +1,6 @@
using UnityEngine;
using UnityEngine.UI;
using UnityProgressBar;
public class UIManager : MonoBehaviour
{
@@ -25,6 +26,8 @@ public class UIManager : MonoBehaviour
public SpriteRenderer lastLifeLabel;
public ProgressBar progressBar;
private AudioSource audioSource;
private float warningTimer = 0f;
@@ -56,6 +59,17 @@ public class UIManager : MonoBehaviour
percentCoveredText.text = $"{Clamp(player.percentCovered, 0, 100)}";
lasersText.text = $"{Clamp(player.laserCount, 0, 99)}";
magnetsText.text = $"{Clamp(player.magnetCount, 0, 99)}";
progressBar.Value = player.speedBonus;
if (player.multiplier != 1)
{
int multiplierValue = player.multiplier == 0.5f ? 1 : (int)(player.multiplier);
multiplierText.text = $"{multiplierValue}";
}
else
{
multiplierText.text = "";
}
if (player.lives == 1)
{
@@ -4,6 +4,11 @@ public class YummyLightningBolt : YummyBase
{
protected override void ObtainedCallback(Player player)
{
player.barPower += 0.1f;
player.speedBonus += 0.05f;
if (player.speedBonus > 1f)
{
player.speedBonus = 1f;
}
}
}