summaryrefslogtreecommitdiff
path: root/GameCode/UniBonusUI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameCode/UniBonusUI.cs')
-rw-r--r--GameCode/UniBonusUI.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/GameCode/UniBonusUI.cs b/GameCode/UniBonusUI.cs
new file mode 100644
index 0000000..8d29a9b
--- /dev/null
+++ b/GameCode/UniBonusUI.cs
@@ -0,0 +1,46 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class UniBonusUI : MonoBehaviour
+{
+ public static UniBonusUI instance;
+
+ [SerializeField]
+ private GameObject uniUI;
+
+ [SerializeField]
+ private Text uniUIText;
+
+ private int healthTotal;
+
+ private int armorTotal;
+
+ private int shieldTotal;
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ public void UniBonus(int health, int armor, int shield)
+ {
+ healthTotal += health;
+ armorTotal += armor;
+ shieldTotal += shield;
+ uniUI.SetActive(value: true);
+ string text = "";
+ if (healthTotal > 0)
+ {
+ text = text + "+" + healthTotal + "HD";
+ }
+ if (armorTotal > 0)
+ {
+ text = text + "\n+" + armorTotal + "AD";
+ }
+ if (shieldTotal > 0)
+ {
+ text = text + "\n+" + shieldTotal + "SD";
+ }
+ uniUIText.text = text;
+ }
+}