Exemple #1
0
    public void UpdateGauge()
    {
        float i_currentValue = EnergyManager.GetEnergy();

        gaugeFillLerped.fillAmount = Mathf.Lerp(gaugeFillLerped.fillAmount, EnergyManager.GetDisplayedEnergy(), Time.deltaTime * 8);
        gaugeFillRay.fillAmount    = gaugeFillLerped.fillAmount;

        if (Mathf.Abs(i_currentValue - previousValue) >= 0.1f)
        {
            transform.DOShakeScale(0.1f, 0.1f).OnComplete(ResetScale);
        }
        previousValue = i_currentValue;

        if (EnergyManager.GetEnergy() >= 0.99f)
        {
            textAnimator.SetBool("dunkReady", true);
            gaugeFillLerped.color = new Color(fullGaugeColor.r, fullGaugeColor.g, fullGaugeColor.b, gaugeFillLerped.color.a);
            gaugeFillRay.color    = new Color(fullGaugeColor.r, fullGaugeColor.g, fullGaugeColor.b, gaugeFillLerped.color.a);
        }
        else
        {
            gaugeFillLerped.color = new Color(defaultGaugeColor.r, defaultGaugeColor.g, defaultGaugeColor.b, gaugeFillLerped.color.a);
            gaugeFillRay.color    = new Color(defaultGaugeColor.r, defaultGaugeColor.g, defaultGaugeColor.b, gaugeFillLerped.color.a);
            textAnimator.SetBool("dunkReady", false);
        }
    }