예제 #1
0
 void Update()
 {
     if (Mathf.Approximately(healthComponent.GetFraction(), 0) || Mathf.Approximately(healthComponent.GetFraction(), 1))
     {
         rootCanvas.gameObject.SetActive(false);
         return;
     }
     rootCanvas.gameObject.SetActive(true);
     foreground.localScale = new Vector3(healthComponent.GetFraction(), 1, 1);
 }
예제 #2
0
 void Update()
 {
     if (Mathf.Approximately(healthcomponent.GetFraction(), 0) || Mathf.Approximately(healthcomponent.GetFraction(), 1))
     {
         rootCanvas.enabled = false;
         return;
     }
     rootCanvas.enabled    = true;
     foreground.localScale = new Vector3(healthcomponent.GetFraction(), 1, 1);
 }
예제 #3
0
        private void Update()
        {
            if (Mathf.Approximately(health.GetFraction(), 0))
            {
                rootCanvas.enabled = false;
                return;
            }

            rootCanvas.enabled    = true;
            foreground.localScale = new Vector3(health.GetFraction(), 1f, 1f);
        }
        private void Update()
        {
            if (health.GetFraction() < 1 && health.GetFraction() > 0)
            {
                SetHealthBar();
            }

            if (health.GetFraction() <= 0)
            {
                healthBarCanvas.enabled = false;
            }
        }
예제 #5
0
        // Update is called once per frame
        void Update()
        {
            if (Mathf.Approximately(health.GetFraction(), 0) ||
                Mathf.Approximately(health.GetFraction(), 1))
            {
                canvas.enabled = false;
                return;
            }

            canvas.enabled = true;
            foreGround.rectTransform.localScale = new Vector3(health.GetFraction(), 1, 1);
        }
예제 #6
0
        void Update()
        {
            //Floats are never exact (depends on CPU)
            if (Mathf.Approximately(healthComponent.GetFraction(), 0) || Mathf.Approximately(healthComponent.GetFraction(), 1))
            {
                rootCanvas.enabled = false;
                return;
            }

            rootCanvas.enabled    = true;
            foreground.localScale = new Vector3(healthComponent.GetFraction(), 1, 1);
        }
예제 #7
0
        void Update()
        {
            if (Mathf.Approximately(healthComponent.GetFraction(), 0) || Mathf.Approximately(healthComponent.GetFraction(), 1))
            {
                rootCanvas.enabled = false;
                return; // returns out of update function as false only to be tested again each update()
            }

            rootCanvas.enabled = true;

            foreground.localScale = new Vector3(healthComponent.GetFraction(), 1, 1);
        }
예제 #8
0
        void Update()
        {
            float healthFraction = healthComponent.GetFraction();

            if (Mathf.Approximately(healthFraction, 0) || Mathf.Approximately(healthFraction, 1))
            {
                canvas.enabled = false;
                return;
            }

            canvas.enabled        = true;
            foreground.localScale = new Vector3(healthComponent.GetFraction(), 1, 1);
        }
예제 #9
0
        void Update()
        {
            //eğer değer 0 ile 1(0.9999999) arasındaysa değer 1 ken yani
            //düşmana henüz saldırılmamışsa can barı gözükmüyor
            if (Mathf.Approximately(healthComponent.GetFraction(), 0) ||
                Mathf.Approximately(healthComponent.GetFraction(), 1))
            {
                //değer sıfırdan düşük veya 1 den yüksekse healthbarı ekrandan kaldırıyoruz
                rootCanvas.enabled = false;
                return;
            }

            rootCanvas.enabled = true;
            //HealthBar Bardaki resmin(foreground) scale değerini cana göre ayarlıyarak gösterioruz
            foreground.localScale = new Vector3(healthComponent.GetFraction(), 1, 1);
        }
예제 #10
0
 void Update()
 {
     // Vector2 size = rt.sizeDelta;
     // size.x = barWidth * health.GetPercentage()/100;
     // rt.sizeDelta = size;
     slider.value = slider.maxValue * health.GetFraction();
 }
예제 #11
0
        private void Update()
        {
            float healthFraction = health.GetFraction();

            if (shoundHide)
            {
                if (Mathf.Approximately(healthFraction, 0f) ||
                    Mathf.Approximately(healthFraction, 1f))
                {
                    rootCanvas.enabled = false;
                }
                else
                {
                    rootCanvas.enabled = true;
                }
            }

            foreground.localScale = new Vector3(health.GetFraction(), 1f, 1f);
        }
예제 #12
0
        void Update()
        {
            float health = healthComponent.GetFraction();

            if (Mathf.Approximately(health, 0f) || Mathf.Approximately(health, 1f))
            {
                rootCanvas.enabled = false;
                return;
            }
            rootCanvas.enabled    = true;
            foreground.localScale = new Vector3(health, 1f, 1f);
        }
예제 #13
0
        private void Update()
        {
            if (foreground == null)
            {
                return;
            }
            if (healthComponent == null)
            {
                return;
            }

            if (Mathf.Approximately(healthComponent.GetFraction(), 0))
            {
                rootCanvas.enabled = false;
                return;
            }
            else if (Mathf.Approximately(healthComponent.GetFraction(), 1))
            {
                rootCanvas.enabled = true;
                return;
            }
            foreground.localScale = new Vector3(healthComponent.GetFraction(), 1, 1);
        }
예제 #14
0
        void Update()
        {
            float healthPercentage = healthComponent.GetFraction();

            if (Mathf.Approximately(healthPercentage, 1) || Mathf.Approximately(healthPercentage, 0) || float.IsNaN(healthPercentage))
            {
                rootCanvas.enabled = false;
                return;
            }
            else
            {
                foreground.localScale = new Vector3(healthPercentage, 1f, 1f);
                rootCanvas.enabled    = true;
            }
        }
예제 #15
0
 private void Update()
 {
     healthSlider.value = health.GetFraction();
 }
 private void Update()
 {
     transform.localScale = new Vector3(health.GetFraction(), 1, 1);
 }