/// <summary> /// Fades the time scale to the specified value /// </summary> public void SetTimeScale(float targetTimeScale, float lerpDuration, LerpManager.LerpMode lerpMode) { if (lerpDuration > 0.0f) //With fading { currentId++; switch (lerpMode) { case LerpManager.LerpMode.NormalLerp: LerpManager.Instance.StartLerp(currentIdGetter, timeScaleGetter, timeScaleSetter, targetTimeScale, lerpDuration, LerpManager.LerpMode.NormalLerp, TimeScaleFadingFinished, null); break; case LerpManager.LerpMode.EaseOutLerp: LerpManager.Instance.StartLerp(currentIdGetter, timeScaleGetter, timeScaleSetter, targetTimeScale, lerpDuration, LerpManager.LerpMode.EaseOutLerp, TimeScaleFadingFinished, null); break; case LerpManager.LerpMode.EaseInLerp: LerpManager.Instance.StartLerp(currentIdGetter, timeScaleGetter, timeScaleSetter, targetTimeScale, lerpDuration, LerpManager.LerpMode.EaseInLerp, TimeScaleFadingFinished, null); break; case LerpManager.LerpMode.SmoothLerp: LerpManager.Instance.StartLerp(currentIdGetter, timeScaleGetter, timeScaleSetter, targetTimeScale, lerpDuration, LerpManager.LerpMode.SmoothLerp, TimeScaleFadingFinished, null); break; case LerpManager.LerpMode.SmootherLerp: LerpManager.Instance.StartLerp(currentIdGetter, timeScaleGetter, timeScaleSetter, targetTimeScale, lerpDuration, LerpManager.LerpMode.SmootherLerp, TimeScaleFadingFinished, null); break; } } else //Without fading { Time.timeScale = targetTimeScale; } }
/// <summary> /// Resumes the game with a time scale fading /// </summary> public void ResumeGame(float lerpDuration, LerpManager.LerpMode lerpMode) { SetTimeScale(0.0f, lerpDuration, lerpMode); }
/// <summary> /// Sets the time scale to the specified value /// </summary> public void SetTimeScale(float targetTimeScale, LerpManager.LerpMode lerpMode) { SetTimeScale(targetTimeScale, 0.0f, lerpMode); }