Ejemplo n.º 1
0
    private void ControllBar(KindBarHUD kindBarHUD, float value, float defValue, Material materialBar, TextMeshProUGUI textProBar)
    {
        float fillTarget = GetBarPropetriesHUD(kindBarHUD).fillTarget;
        float delta      = GetBarPropetriesHUD(kindBarHUD).delta;

        delta     -= GetBarPropetriesHUD(kindBarHUD).fillTarget - PercentToValue(1, ValueToPercent(value, defValue));
        fillTarget = PercentToValue(1, ValueToPercent(value, defValue));


        if (textProBar != null)
        {
            textProBar.text = ValueToPercent(value, defValue) + "%";
        }

        delta = Mathf.Lerp(delta, 0, Time.deltaTime * GetBarPropetriesHUD(kindBarHUD).dampening);

        SetPropertiesDelta(kindBarHUD, delta);
        SetPropertiesFillTarget(kindBarHUD, fillTarget);

        materialBar.SetFloat("_Delta", GetBarPropetriesHUD(kindBarHUD).delta);
        materialBar.SetFloat("_Fill", GetBarPropetriesHUD(kindBarHUD).fillTarget);
    }
Ejemplo n.º 2
0
 public void SetPropertiesFillTarget(KindBarHUD kindBarHUD, float fillTarget)
 {
     _BarPropertiesHUD.FirstOrDefault(x => x.Key == kindBarHUD).Value.fillTarget = fillTarget;
 }
Ejemplo n.º 3
0
 public void SetPropertiesDelta(KindBarHUD kindBarHUD, float delta)
 {
     _BarPropertiesHUD.FirstOrDefault(x => x.Key == kindBarHUD).Value.delta = delta;
 }
Ejemplo n.º 4
0
 public void SetPropertiesMaterial(KindBarHUD kindBarHUD, Material materialBar)
 {
     _BarPropertiesHUD.FirstOrDefault(x => x.Key == kindBarHUD).Value.barMaterial = materialBar;
 }
Ejemplo n.º 5
0
 public BarPropertie GetBarPropetriesHUD(KindBarHUD kindBarHUD)
 {
     return(_BarPropertiesHUD.FirstOrDefault(x => x.Key == kindBarHUD).Value);
 }
Ejemplo n.º 6
0
 private void ControllBarStamine(KindBarHUD kindBarHUD, float stamine, float deStamine, Material materialStamineBar, TextMeshProUGUI textProBarHealth)
 {
     ControllBar(kindBarHUD, stamine, deStamine, materialStamineBar, textProBarHealth);
 }
Ejemplo n.º 7
0
 private void ControllBarHealth(KindBarHUD kindBarHUD, float health, float defHealth, Material materialHealthBar, TextMeshProUGUI textProBarHealth)
 {
     ControllBar(kindBarHUD, health, defHealth, materialHealthBar, textProBarHealth);
 }