void Update() { GameObject player = Player.player; panel.SetActive(player != null); // hide while not in the game world if (!player) { return; } // health Health health = player.GetComponent <Health>(); healthSlider.value = health.Percent(); healthStatus.text = health.current + " / " + health.max; // mana Mana mana = player.GetComponent <Mana>(); manaSlider.value = mana.Percent(); manaStatus.text = mana.current + " / " + mana.max; // endurance Endurance endurance = player.GetComponent <Endurance>(); enduranceSlider.value = endurance.Percent(); enduranceStatus.text = endurance.current + " / " + endurance.max; }
void Update() { GameObject player = Player.player; if (!player) { return; } Health health = player.GetComponent <Health>(); healthSlider.value = health.Percent(); healthStatus.text = health.current + " / " + health.max; Mana mana = player.GetComponent <Mana>(); manaSlider.value = mana.Percent(); manaStatus.text = mana.current + " / " + mana.max; Endurance endurance = player.GetComponent <Endurance>(); enduranceSlider.value = endurance.Percent(); enduranceStatus.text = endurance.current + " / " + endurance.max; levelText.text = player.GetComponent <Level>().current.ToString(); damageText.text = player.GetComponent <Combat>().damage.ToString(); defenseText.text = player.GetComponent <Combat>().defense.ToString(); }