private IEnumerator AnimateFill(float target, BindingAnimationStatus status) { while (_image.fillAmount != target) { var speed = Speed * Time.deltaTime; var fill = Mathf.MoveTowards(_image.fillAmount, target, speed); SetFill(fill); yield return(null); } status?.Decrement(); }
private IEnumerator VariableChanged(VariableValue value, BindingAnimationStatus status) { status.Increment(); _value = value; CompositionManager.Instance.RunInstruction(Graph, Variables, VariableValue.Create(gameObject)); while (Graph.IsRunning) { yield return(null); } status.Decrement(); }
public override void UpdateBinding(IVariableStore variables, BindingAnimationStatus status) { status?.Increment(); var value = GetValue(variables); if (Speed <= 0) { SetValue(value); status?.Decrement(); } else { StartCoroutine(AnimateValue(value, status)); } }
public override void UpdateBinding(IVariableStore variables, BindingAnimationStatus status) { status?.Increment(); var fill = GetFill(variables); if (Speed <= 0.0f) { SetFill(fill); status?.Decrement(); } else { StartCoroutine(AnimateFill(fill, status)); } }
private IEnumerator AnimateFill(float target, BindingAnimationStatus status) { status.Increment(); while (_image.fillAmount != target) { var delta = UseScaledTime ? Time.deltaTime : Time.unscaledDeltaTime; var speed = Speed * delta; var fill = Mathf.MoveTowards(_image.fillAmount, target, speed); SetFill(fill); yield return(null); } status.Decrement(); }
private IEnumerator AnimateValue(int target, BindingAnimationStatus status) { if (int.TryParse(_text.text, out var current)) { var value = (float)current; while (current != target) { var speed = Speed * Time.deltaTime; value = Mathf.MoveTowards(value, (float)target, speed); current = Mathf.RoundToInt(value); SetValue(current); yield return(null); } } else { Debug.LogWarningFormat(this, _invalidTextWarning, name); } status?.Decrement(); }