Exemplo n.º 1
0
        private void TryCompleteEvents(int index, float value, float normTimer, FloatAnimationData data)
        {
            List <AnimationEventInfo <float> > dataEvents = events[index];

            foreach (AnimationEventInfo <float> 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;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void PrepareWaiting()
        {
            FloatAnimationData animData = new FloatAnimationData {
                StartValue = shipTransform.localEulerAngles.z,
                EndValue   = 0,
                Duration   = 0.5f,
                Target     = shipTransform.gameObject,
                EaseType   = EaseType.EaseInOutQuad,
                OnStart    = shipTransform.UpdateZRotation(),
                OnUpdate   = shipTransform.UpdateZRotationTimed(),
                OnEnd      = shipTransform.UpdateZRotation(() => {
                    isPreparing = false;
                    waitTimer   = 0;
                })
            };

            shipTransform.gameObject.GetOrAdd <FloatAnimator>().StartAnimation(animData);
        }
Exemplo n.º 3
0
        private void PrepareExploring()
        {
            FloatAnimationData animData = new FloatAnimationData {
                StartValue = 0,
                EndValue   = 52,
                Duration   = 0.5f,
                EaseType   = EaseType.EaseInOutQuad,
                Target     = shipTransform.gameObject,
                OnStart    = (v, o) => shipTransform.localRotation = Quaternion.Euler(0, 0, v),
                OnUpdate   = (v, t, o) => shipTransform.localRotation = Quaternion.Euler(0, 0, v),
                OnEnd      = (v, o) => {
                    shipTransform.localRotation = Quaternion.Euler(0, 0, v);
                    isExploring  = true;
                    isReturning  = true;
                    isPreparing  = false;
                    waitTimer    = 0;
                    exploreTimer = 0;
                }
            };

            shipTransform.gameObject.GetOrAdd <FloatAnimator>().StartAnimation(animData);
        }
Exemplo n.º 4
0
        private void ChangeBackgroundMusicInner(SoundName name)
        {
            FloatAnimator animator = LegacyManager.backgroundMusicSource.gameObject.GetOrAdd <FloatAnimator>();

            var unmuteData = new FloatAnimationData {
                StartValue = 0,
                EndValue   = 1,
                Duration   = 1,
                EaseType   = EaseType.Linear,
                OnStart    = (v, o) => LegacyManager.backgroundMusicSource.volume = v,
                OnUpdate   = (v, t, o) => LegacyManager.backgroundMusicSource.volume = v,
                OnEnd      = (v, o) => {
                    LegacyManager.backgroundMusicSource.volume = v;
                    isBackgroundMusicInChanging = false;
                }
            };

            var muteData = new FloatAnimationData {
                StartValue = 1,
                EndValue   = 0,
                Duration   = 1,
                EaseType   = EaseType.Linear,
                Target     = animator.gameObject,
                OnStart    = (v, o) => LegacyManager.backgroundMusicSource.volume = v,
                OnUpdate   = (v, t, o) => LegacyManager.backgroundMusicSource.volume = v,
                OnEnd      = (v, o) => {
                    LegacyManager.backgroundMusicSource.volume = v;
                    LegacyManager.backgroundMusicSource.clip   = Services.ResourceService.Audio.GetObject(name);
                    LegacyManager.backgroundMusicSource.Play();
                    animator.StartAnimation(unmuteData);
                }
            };

            animator.StartAnimation(muteData);
            isBackgroundMusicInChanging = true;
        }
Exemplo n.º 5
0
 public void StartAnimation(FloatAnimationData data)
 {
     StartAnimation(new List <FloatAnimationData> {
         data
     });
 }