Example #1
0
        /// <summary>
        /// Repeat execution while callback return is true.
        /// </summary>
        static public Animate Repeat(float duration_, System.Func <bool> callback_, int maxRepeat = -1)
        {
            Animate newAnimation = new Animate(duration_, null, () => {
                if (callback_?.Invoke() == true)
                {
                    if (maxRepeat == 0)
                    {
                        return;
                    }
                    else
                    {
                        if (maxRepeat != -1)
                        {
                            maxRepeat--;
                        }
                    }
                    Animate.Repeat(duration_, callback_, maxRepeat);
                }
            });

            newAnimation.Play(); AnimateManager.GetInstance().AddAnimation(newAnimation); return(newAnimation);
        }
Example #2
0
        /// <summary>
        /// Wait a fixed duration before calling function.
        /// </summary>
        static public Animate Delay(float duration_, System.Action endCallback_)
        {
            Animate newAnimation = new Animate(duration_, null, endCallback_);

            newAnimation.Play(); AnimateManager.GetInstance().AddAnimation(newAnimation); return(newAnimation);
        }
Example #3
0
        /// <summary>
        /// Used to receive a T value from 0.0f to 1.0f over a certain duration each frame.
        /// </summary>
        static public Animate LerpSomething(float duration_, System.Action <float> stepCallback_, System.Action endCallback_ = null)
        {
            Animate newAnimation = new Animate(duration_, stepCallback_, endCallback_);

            newAnimation.Play(); AnimateManager.GetInstance().AddAnimation(newAnimation); return(newAnimation);
        }