// Update is called once per frame void Update() { float hp = player.GetHp(); if (hp <= 0) { string tempText = "!HULL BREACHED!"; text.text = tempText + baseText; } else if (displayedHp != hp) { string tempText = ""; for (int i = 0; i < hp; i++) { tempText += "O"; } text.text = tempText + baseText; } if (hp < maxHp / 4.0f || hp <= 1.0f) { text.color = Color.red; } else { if (hp <= maxHp / 2.0f) { text.color = Color.yellow; } else { text.color = Color.green; } } }