示例#1
0
 private void UpdateSlowMode()
 {
     if (this._slowModeState == SlowModeState.IN)
     {
         this._currentTimeScale = this.slowModeTimeScale;
     }
     else if (this._slowModeState == SlowModeState.OUT)
     {
         this._currentTimeScale = this.timeScale;
     }
     else if (this._slowModeState == SlowModeState.ENTERING)
     {
         this._transTimer      += Time.unscaledDeltaTime;
         this._currentTimeScale = Mathf.Lerp(this._startTimeScale, this.slowModeTimeScale, Mathf.Clamp01(this._transTimer / this.slowModeEnterDuration));
         if (this._transTimer > this.slowModeEnterDuration)
         {
             this._slowModeState = SlowModeState.IN;
         }
     }
     else if (this._slowModeState == SlowModeState.LEAVING)
     {
         this._transTimer      += Time.unscaledDeltaTime;
         this._currentTimeScale = Mathf.Lerp(this.slowModeTimeScale, this.timeScale, Mathf.Clamp01(this._transTimer / this.slowModeLeaveDuration));
         if (this._transTimer > this.slowModeLeaveDuration)
         {
             this._slowModeState = SlowModeState.OUT;
         }
     }
     if (this._slowModeState != SlowModeState.OUT)
     {
         this._currentTimeScale /= this._systemTimeScale;
     }
 }
示例#2
0
 public void LeaveSlowMode()
 {
     if (this._slowModeState == SlowModeState.IN)
     {
         this._slowModeState = SlowModeState.LEAVING;
         this._transTimer    = 0f;
     }
 }
示例#3
0
 public void EnterSlowMode(float startTimeScale)
 {
     if (this._slowModeState == SlowModeState.OUT)
     {
         this._slowModeState  = SlowModeState.ENTERING;
         this._transTimer     = 0f;
         this._startTimeScale = startTimeScale;
     }
 }