Beispiel #1
0
        private void TryCompleteEvents(int index, Color value, float normTimer, ColorAnimationData Data)
        {
            List <AnimationEventInfo <Color> > dataEvents = events[index];

            foreach (AnimationEventInfo <Color> evt in dataEvents)
            {
                if ((evt.Event.Mode == AnimationEventMode.Single && !evt.IsCompleted) ||
                    (evt.Event.Mode == AnimationEventMode.Multiple))
                {
                    if (evt.Event.IsValid?.Invoke(value, normTimer, Data.Target) ?? false)
                    {
                        evt.Event.OnEvent?.Invoke(value, normTimer, Data.Target);
                        evt.IsCompleted = true;
                    }
                }
            }
        }
Beispiel #2
0
        public static ColorAnimationData GetColorAnimData(Color start, Color end, float duration, EaseType easeType,
                                                          RectTransform target, BosAnimationMode mode = BosAnimationMode.Single, System.Action onEnd = null)
        {
            Graphic graphic = target.GetComponent <Graphic>();

            ColorAnimationData data = new ColorAnimationData {
                StartValue = start,
                EndValue   = end,
                Duration   = duration,
                Target     = target.gameObject,
                EaseType   = easeType,
                OnStart    = (c, o) => graphic.color = c,
                OnUpdate   = (c, t, o) => graphic.color = c,
                OnEnd      = (c, o) => {
                    graphic.color = c;
                    onEnd?.Invoke();
                },
                AnimationMode = mode
            };

            return(data);
        }
Beispiel #3
0
 public void StartAnimation(ColorAnimationData data)
 => StartAnimation(new List <ColorAnimationData> {
     data
 });