Example #1
0
        private void Start()
        {
            RectTransform trs      = GetComponent <RectTransform>();
            FloatAnimator animator = gameObject.GetOrAdd <FloatAnimator>();

            updateTimer.Setup(4, (delta) => {
                animator.StartAnimation(new FloatAnimationData {
                    StartValue    = 0,
                    EndValue      = 30,
                    Duration      = 0.5f,
                    AnimationMode = BosAnimationMode.Single,
                    EaseType      = EaseType.EaseInOutQuad,
                    Target        = gameObject,
                    OnStart       = (v, o) => trs.localRotation = Quaternion.Euler(0, 0, v),
                    OnUpdate      = (v, t, o) => trs.localRotation = Quaternion.Euler(0, 0, v),
                    OnEnd         = (v, o) => {
                        trs.localRotation = Quaternion.Euler(0, 0, v);
                        animator.StartAnimation(new FloatAnimationData {
                            StartValue    = 30,
                            EndValue      = 0,
                            Duration      = 0.5f,
                            AnimationMode = BosAnimationMode.Single,
                            EaseType      = EaseType.EaseInOutQuad,
                            Target        = gameObject,
                            OnStart       = (v2, o2) => trs.localRotation = Quaternion.Euler(0, 0, v2),
                            OnUpdate      = (v2, t2, o2) => trs.localRotation = Quaternion.Euler(0, 0, v2),
                            OnEnd         = (v2, o2) => trs.localRotation = Quaternion.Euler(0, 0, v2)
                        });
                    }
                });
            });
        }
        private void Animate()
        {
            FloatAnimator animator = gameObject.GetOrAdd <FloatAnimator>();

            animator.Stop();

            animator.StartAnimation(new FloatAnimationData {
                StartValue    = startValue,
                EndValue      = endValue,
                Duration      = duration,
                EaseType      = easeType,
                AnimationMode = mode,
                Target        = gameObject,
                OnStart       = (v, o) => canvasGroup.alpha = v,
                OnUpdate      = (v, t, o) => canvasGroup.alpha = v,
                OnEnd         = (v, o) => canvasGroup.alpha = v
            });
        }
Example #3
0
        private void Animate()
        {
            FloatAnimator animator = gameObject.GetOrAdd <FloatAnimator>();

            animator.Stop();

            animator.StartAnimation(new FloatAnimationData {
                StartValue    = startValue,
                EndValue      = endValue,
                Duration      = duration,
                EaseType      = easeType,
                AnimationMode = mode,
                Target        = gameObject,
                OnStart       = rectTransform.UpdateZRotation(),
                OnUpdate      = rectTransform.UpdateZRotationTimed(),
                OnEnd         = rectTransform.UpdateZRotation()
            });
        }
Example #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;
        }