public void SetPause(bool value, int stateIndex = 0) { if (stateIndex < 0 || 63 < stateIndex) { #if LOG_DEBUG #if UNITY_5_6_OR_NEWER UnityEngine.Debug.LogWarning("DYNAMIC_TIMER:INVALID_STATEINDEX:" + stateIndex); #endif // UNITY_5_6_OR_NEWER #endif // LOG_DEBUG return; } bool prev = this.Paused; this.pauseStatus = BitFlag.SetField(this.pauseStatus, stateIndex, value); bool next = this.Paused; if (prev != next) { var ms = this.GetTimeMs(); if (next) { this.pausedMs = ms; } else { this.fromMs += ms - this.pausedMs; this.pausedMs = 0; } } }