Exemplo n.º 1
0
    public virtual Tween AnimateCurrent(float newValue, float totalDuration)
    {
        var   newCurrent = Mathf.Min(newValue, maximum);
        float duration   = Mathf.Abs(newCurrent - current) / (maximum - minimum) * totalDuration;

        return(DOTween.To((value) => {
            current = value;
            OnProgressAnimated?.Invoke(value);
            UpdateCurrentFill();
        }, current, newCurrent, duration).OnComplete(() => {
            current = newValue;
            OnProgressAnimated?.Invoke(newValue);
            UpdateCurrentFill();
        }));
    }
Exemplo n.º 2
0
 protected void TriggerOnProgressAnimated(float value)
 {
     OnProgressAnimated?.Invoke(value);
 }