blob: 8d29a9b205d637959563cc307a9ab00d86bfa866 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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;
}
}
|