Example #1
0
        private void Update()
        {
            float t = timer / from.duration;

            Interpolate(t);

            if (timer >= from.duration)
            {
                if (currentIndex > -direction && currentIndex < steps.Count - 1 - direction)
                {
                    currentIndex += direction;
                    SetupFromIndex(currentIndex, direction);
                    timer -= from.duration;
                }
                else
                {
                    to.onEnter.Invoke();
                    onFinish.Call();

                    enabled = false;
                }
            }

            timer += Time.deltaTime;
        }
Example #2
0
            public Latency TryCall(SafeAction onTimer)
            {
                if (length >= 0.0f)
                {
                    onTimer.Call();
                }

                return(this);
            }
Example #3
0
 /// <summary>
 /// You need to manually call this at your script Update() method
 /// for the timer to work properly.
 /// </summary>
 public void OnUpdate()
 {
     if (startTime < 0.0f)
     {
         // Already triggered callback.
     }
     else if (CurrentTime >= startTime + length)
     {
         startTime = -1.0f;
         onTimer.Call();
     }
 }
Example #4
0
        /// <summary>
        /// You need to manually call this at your script Update() method for the timer to work properly.
        /// </summary>
        /// <param name="deltaTime"></param>
        public void OnUpdate(float deltaTime)
        {
            if (elapsedTime >= 0.0f)
            {
                elapsedTime += deltaTime;
            }

            if (elapsedTime >= length)
            {
                elapsedTime = -1.0f;
                onTimer.Call();
            }
        }
Example #5
0
        private void Update()
        {
            float t = Mathf.InverseLerp(0.0f, from.duration, timer);

            Interpolate(t);

            if (timer >= from.duration)
            {
                enabled = false;
                onFinish.Call();
            }

            timer += Time.deltaTime;
        }
Example #6
0
        /// <summary>
        /// You need to manually call this at your script Update() method for the timer to work properly.
        /// </summary>
        /// <param name="deltaTime"></param>
        public void OnUpdate(float deltaTime)
        {
            if (elapsedTime >= 0.0f)
            {
                elapsedTime += deltaTime;
            }

            float latency = elapsedTime - length;

            if (latency >= 0)
            {
                elapsedTime = -1.0f;
                onTimer.Call();
                onTimerPrecise.Call(latency);
            }
        }
 public void Complete(A value)
 {
     result = value;
     onComplete.Call(value);
     onComplete.UnregisterAll();
 }