예제 #1
0
        private IEnumerator StartAnimationImpl(List <FloatAnimationData> datas)
        {
            if (isWaitingForStart)
            {
                yield break;
            }
            if (IsStarted)
            {
                isWaitingForStart = true;
            }
            yield return(new WaitUntil(() => false == IsStarted));

            isWaitingForStart = false;

            if (!IsStarted)
            {
                Datas.Clear();
                foreach (var data in datas)
                {
                    Datas.Add(new BosFloatAnimationInfo {
                        Data      = data,
                        Direction = BosAnimationDirection.Forward
                    });
                }
                timer = 0f;
                easeFuncs.Clear();
                events.Clear();

                for (int i = 0; i < Datas.Count; i++)
                {
                    easeFuncs.Add(AnimUtils.GetEaseFunc(Datas[i].Data.EaseType));
                    List <AnimationEventInfo <float> > dataEvents = new List <AnimationEventInfo <float> >();
                    if (Datas[i].Data.Events != null)
                    {
                        foreach (AnimationEvent <float> evt in Datas[i].Data.Events)
                        {
                            dataEvents.Add(new AnimationEventInfo <float> {
                                Event       = evt,
                                IsCompleted = false
                            });
                        }
                    }
                    events.Add(dataEvents);
                }
                isStartedStatus.Clear();
                for (int i = 0; i < Datas.Count; i++)
                {
                    isStartedStatus.Add(true);
                }
                Datas.ForEach(d => d.Data.OnStart?.Invoke(d.Data.StartValue, d.Data.Target));
            }
        }