Exemplo n.º 1
0
        void Update()
        {
            float value = health.GetHealth() / health.GetMAxHealth();

            if (Mathf.Approximately(value, 1) || Mathf.Approximately(value, 0))
            {
                canvas.enabled = false;
                return;
            }
            canvas.enabled        = true;
            Foreground.localScale = new Vector3(value, 1, 1);
        }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     healthSlider.value = health.GetHealth() / health.GetMAxHealth();
 }