예제 #1
0
        private void AnimateToState(BGMState state)
        {
            if (coroutine_ != null)
            {
                coroutine_.Cancel();
                coroutine_ = null;
            }

            float oldVolume = backgroundMusicAudioSource_.volume;
            float newVolume = 0.0f;

            switch (state)
            {
            case BGMState.Normal:
                newVolume = 1.0f;
                break;

            case BGMState.Muted:
                newVolume = kBGMMutedVolume;
                break;
            }

            coroutine_ = CoroutineWrapper.DoEaseFor(kBGMStateTransitionDuration, EaseType.SineEaseInOut, (float p) => {
                backgroundMusicAudioSource_.volume = Mathf.Lerp(oldVolume, newVolume, p);
            });
        }
예제 #2
0
        private void SetDepthOfFieldEnabledInternal(bool enabled, bool animate)
        {
            if (depthOfFieldCoroutine_ != null)
            {
                depthOfFieldCoroutine_.Cancel();
                depthOfFieldCoroutine_ = null;
            }

            DepthOfFieldModel.Settings settings = postProcessingProfile_.depthOfField.settings;
            if (!animate)
            {
                settings.focalLength = enabled ? kMaxFocalLength : kMinFocalLength;
                postProcessingProfile_.depthOfField.settings = settings;
                postProcessingProfile_.depthOfField.enabled  = enabled;
            }
            else
            {
                postProcessingProfile_.depthOfField.enabled = true;
                float start = enabled ? kMinFocalLength : kMaxFocalLength;
                float end   = enabled ? kMaxFocalLength : kMinFocalLength;
                depthOfFieldCoroutine_ = CoroutineWrapper.DoEaseFor(kDepthOfFieldAnimationDuration, EaseType.CubicEaseOut, (float p) => {
                    settings.focalLength = Mathf.Lerp(start, end, p);
                    postProcessingProfile_.depthOfField.settings = settings;
                }, () => {
                    postProcessingProfile_.depthOfField.enabled = enabled;
                });
            }
        }
예제 #3
0
 private void CleanupSelectorAnimationCoroutine()
 {
     if (selectorAnimationCoroutine_ != null)
     {
         selectorAnimationCoroutine_.Cancel();
         selectorAnimationCoroutine_ = null;
     }
 }
예제 #4
0
 private void CancelAnimation()
 {
     if (animateCoroutine_ != null)
     {
         animateCoroutine_.Cancel();
         animateCoroutine_ = null;
     }
 }
예제 #5
0
 private void CancelReflectCoroutine()
 {
     if (reflectCoroutine_ != null)
     {
         reflectCoroutine_.Cancel();
         reflectCoroutine_ = null;
     }
 }
예제 #6
0
 protected override void OnStateExited()
 {
     StateMachine_.InputState.CancelTargetMovementVector();
     if (coroutine_ != null)
     {
         coroutine_.Cancel();
         coroutine_ = null;
     }
 }
예제 #7
0
        protected override void OnStateExited()
        {
            movementAction_.Dispose();

            if (coroutine_ != null)
            {
                coroutine_.Cancel();
                coroutine_ = null;
            }
        }
예제 #8
0
        protected override void OnStateExited()
        {
            ChargedLaserComponent_.OnFullCharge -= HandleFullyChargedLaser;

            if (delayedAttackAction_ != null)
            {
                delayedAttackAction_.Cancel();
                delayedAttackAction_ = null;
            }
        }
예제 #9
0
        private void SetInvulnerableFor(float time)
        {
            if (invulnerableCoroutine_ != null)
            {
                invulnerableCoroutine_.Cancel();
                invulnerableCoroutine_ = null;
            }

            invulnerable_          = true;
            invulnerableCoroutine_ = CoroutineWrapper.DoAfterDelay(time, () => {
                invulnerable_ = false;
            });
        }
예제 #10
0
        private void StopTimeFor(float duration)
        {
            if (timeScaleCoroutine_ != null)
            {
                timeScaleCoroutine_.Cancel();
                timeScaleCoroutine_ = null;
            }

            Time.timeScale      = 0.0f;
            timeScaleCoroutine_ = CoroutineWrapper.DoAfterRealtimeDelay(duration, () => {
                Time.timeScale = 1.0f;
            });
        }
예제 #11
0
        private void AnimateChromaticAberration(float intensity, float duration)
        {
            if (aberrationCoroutine_ != null)
            {
                aberrationCoroutine_.Cancel();
                aberrationCoroutine_ = null;
            }

            aberrationCoroutine_ = CoroutineWrapper.DoEaseFor(duration, EaseType.CubicEaseIn, (float p) => {
                ChromaticAberrationModel.Settings settings = postProcessingProfile_.chromaticAberration.settings;
                settings.intensity = Mathf.Lerp(intensity, 0.0f, p);
                postProcessingProfile_.chromaticAberration.settings = settings;
            });
        }