Ejemplo n.º 1
0
        void Update()
        {
            healthBarCanvas.enabled = HealthBarActive();
            if (!HealthBarActive())
            {
                return;
            }

            float healthFraction = parentHealth.GetHealthFraction();

            barTransform.localScale = new Vector3(healthFraction, 1.0f, 1.0f);
        }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (disableCanvas == true)
     {
         if (Mathf.Approximately(health.GetHealthFraction(), 0) || Mathf.Approximately(health.GetHealthFraction(), 1))
         {
             rootCanvas.enabled = false;
             return;
         }
         rootCanvas.enabled = true;
     }
     if (direction == Direction.X)
     {
         foreground.localScale = new Vector3(health.GetHealthFraction(), 1, 1);
     }
     if (direction == Direction.Y)
     {
         foreground.localScale = new Vector3(1, health.GetHealthFraction(), 1);
     }
     if (direction == Direction.Z)
     {
         foreground.localScale = new Vector3(1, 1, health.GetHealthFraction());
     }
 }
Ejemplo n.º 3
0
        // Start is called before the first frame update

        // Update is called once per frame
        void Update()
        {
            image.fillAmount = health.GetHealthFraction();
        }