示例#1
0
        IEnumerator IAnimation.Play(RectTransform rt, float timeScale, int repeatCount)
        {
            stop         = false;
            source       = new TransformInfo(rt);
            this.rt      = rt;
            timeScale   *= TimeScale;
            repeatCount *= RepeatCount;

            foreach (var a in Animations)
            {
                a.Init(rt);
            }

            for (int i = 0; i < repeatCount; i++)
            {
                var time = 0f;
                while (time < 1)
                {
                    if (stop || !rt)
                    {
                        yield break;
                    }

                    foreach (var a in Animations)
                    {
                        a.Apply(rt, time);
                    }

                    yield return(null);

                    if (stop || !rt)
                    {
                        yield break;
                    }

                    time += Time.unscaledDeltaTime * timeScale;
                    source.Apply(rt);
                }
            }

            foreach (var a in Animations)
            {
                a.OnFinish();
            }
        }