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); }
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); }
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; } }
// 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); }
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); }
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); }
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); }
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); }
void Update() { // Vector2 size = rt.sizeDelta; // size.x = barWidth * health.GetPercentage()/100; // rt.sizeDelta = size; slider.value = slider.maxValue * health.GetFraction(); }
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); }
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); }
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); }
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; } }
private void Update() { healthSlider.value = health.GetFraction(); }
private void Update() { transform.localScale = new Vector3(health.GetFraction(), 1, 1); }