示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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));
            }
        }
示例#4
0
        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));
            }
        }
示例#5
0
        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();
        }
示例#6
0
        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();
        }