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(); })); }
protected void TriggerOnProgressAnimated(float value) { OnProgressAnimated?.Invoke(value); }