Beispiel #1
0
        public float Update()
        {
            if (finished)
            {
                return(value);
            }
            var deltaTime = Time.deltaTime;

            if (respectTimeScale)
            {
                deltaTime *= Find.TickManager.TickRateMultiplier;
            }
            elapsedTime += deltaTime;
            if (elapsedTime >= duration)
            {
                elapsedTime = duration;
                value       = targetValue;
                finished    = true;
                callback?.Invoke(this, value, duration, curve);
            }
            else
            {
                value = initialValue + curve(elapsedTime / duration) * (targetValue - initialValue);
            }
            return(value);
        }
Beispiel #2
0
        public void Execute(object parameter)
        {
            Executing = true;

            _action(parameter).ContinueWith((task) =>
            {
                Executing = false;
                FinishedCallback?.Invoke();
            });
        }
Beispiel #3
0
        public void Execute(object parameter)
        {
            if (!CanExecute(parameter))
            {
                return;
            }

            Executing = true;

            _action(parameter).ContinueWith(task =>
            {
                Executing = false;
                FinishedCallback?.Invoke();
            });
        }