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); }); }
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; }); } }
private void CleanupSelectorAnimationCoroutine() { if (selectorAnimationCoroutine_ != null) { selectorAnimationCoroutine_.Cancel(); selectorAnimationCoroutine_ = null; } }
private void CancelAnimation() { if (animateCoroutine_ != null) { animateCoroutine_.Cancel(); animateCoroutine_ = null; } }
private void CancelReflectCoroutine() { if (reflectCoroutine_ != null) { reflectCoroutine_.Cancel(); reflectCoroutine_ = null; } }
protected override void OnStateExited() { StateMachine_.InputState.CancelTargetMovementVector(); if (coroutine_ != null) { coroutine_.Cancel(); coroutine_ = null; } }
protected override void OnStateExited() { movementAction_.Dispose(); if (coroutine_ != null) { coroutine_.Cancel(); coroutine_ = null; } }
protected override void OnStateExited() { ChargedLaserComponent_.OnFullCharge -= HandleFullyChargedLaser; if (delayedAttackAction_ != null) { delayedAttackAction_.Cancel(); delayedAttackAction_ = null; } }
private void SetInvulnerableFor(float time) { if (invulnerableCoroutine_ != null) { invulnerableCoroutine_.Cancel(); invulnerableCoroutine_ = null; } invulnerable_ = true; invulnerableCoroutine_ = CoroutineWrapper.DoAfterDelay(time, () => { invulnerable_ = false; }); }
private void StopTimeFor(float duration) { if (timeScaleCoroutine_ != null) { timeScaleCoroutine_.Cancel(); timeScaleCoroutine_ = null; } Time.timeScale = 0.0f; timeScaleCoroutine_ = CoroutineWrapper.DoAfterRealtimeDelay(duration, () => { Time.timeScale = 1.0f; }); }
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; }); }