コード例 #1
0
        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());
        }
コード例 #2
0
        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()));
        }
コード例 #3
0
        // 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";
        }