private void Update() { if (fighter.GetTarget() == null) { GetComponent <Text>().text = "N/A"; return; } Health health = fighter.GetTarget(); GetComponent <Text>().text = String.Format("{0:0}%", health.GetPercentage()); }
private void DisplayHealthValue() { health = playerFighter.GetTarget(); if (health == null) { healthValue.SetText("N/A"); return; } healthValue.SetText(String.Format("{0:0}/{1:0} ({2:0}%)", health.GetHealthPoints(), health.GetMaxHealth(), health.GetPercentage())); }
// Update is called once per frame void Update() { Health health = target.GetTarget(); textDisplay.text = health ? String.Format($"{health.CurrentHealth}/{health.MaxHealth} {health.GetPercentage():0}%") : "N/A"; }