// EN POURCENTAGE!!!! public void SetLife(float hpPercentage) { if (!hasStartedplaying) { return; } if (isDed && hpPercentage > 0) { isDed = false; kidAnimator.SetTrigger("stand"); light.GetComponent <lightScript>().SetChildStance(isDed); } if (hpPercentage > 0) { gameObject.GetComponent <SonEnfantScript>().PlayHealSound(); } hp += hpPercentage; if (hp > 100) { healthBar.SetSize(1); hp = 100; } else if (hp > 0) { healthBar.SetSize(hp / 100); } else { hp = 0; healthBar.SetSize(0); Die(); } }
// Updates stamina/health bar. public void UpdateBar(UIBar bar) { if (bar == m_HealthBar) { bar.SetSize(m_Health / m_MaxHealth); } else if (bar == m_StaminaBar) { bar.SetSize((float)m_Stamina / (float)m_MaxStamina); } }
// Updates the force bar. private void UpdateBar(float distance) { if (distance <= 0.0f) { m_ForceBar.SetSize(0.0f); } else if (distance >= m_MaximumDistance) { m_ForceBar.SetSize(1.0f); } else { m_ForceBar.SetSize(distance / m_MaximumDistance); } }
// EN POURCENTAGE!!!! public void SetLight(float lightPourcentage) { light += lightPourcentage; if (light > 100) { light = 100; lightBar.SetSize(1); } else if (light > 0) { lightBar.SetSize(light / 100); } else { light = 0; lightBar.SetSize(0); } }