public void UpdateTimeScaleNew() { if (!UseMod) { orig_UpdateTimeScale(); return; } if ((this.m_PlayerPaused || this.m_UiPaused) && !this.ProhibitPause) { Time.timeScale = 0f; } else if (Cutscene.CutsceneActive || Onyx.SingletonBehavior <ConversationManager> .Instance.IsConversationOrSIRunning()) { Time.timeScale = 1f; } else if (GameState.InCombat && this.TimeScale > 2.1f) { //Time.timeScale = GameState.Option.CombatSpeed; //In combat, need to cache the old and rescale this.TimeScale = 1.0f; } else { Time.timeScale = this.TimeScale; } Config = TimeScale.ToString(); }
/// <summary> /// Report the frequency of a time scale event. /// </summary> /// <param name="timeScale">The time scale event that just occurred.</param> /// <param name="lastTime">The elapsed time to the last occurrence.</param> /// <param name="averageTime">The average time between occurrences.</param> protected virtual void Report(TimeScale timeScale, long lastTime, long averageTime) { if (lastTime != -1 && averageTime != -1) { TimeUnit unit; var inverseTime = PrintUtils.GetInverseTime(averageTime, out unit); string lowerCaseTimescale = timeScale.ToString().ToLower(); _logger.Info($"{inverseTime:###.0} {lowerCaseTimescale}s/{unit.GetTimeUnitInFormat(TimeUnitFormat.Minimum)} (time/{lowerCaseTimescale}: average {PrintUtils.FormatTimeSimple(averageTime)}, last {PrintUtils.FormatTimeSimple(lastTime)})"); } }
IEnumerator KeepTheFlow() //start waves and event pauses { string filename = snapshot_filename + "_lvl" + Central.Instance.current_lvl + "_ff" + ff.ToString() + "_" + Peripheral.Instance.getLevelMod().ToString(); int start_child = 0; while (true) { if (Peripheral.Instance.level_state == LState.WaitingToStartNextWave) { if (take_snapshots) { TakeSnapshot(filename); } if (Moon.Instance.current_wave == 0) { yield return(new WaitForSeconds(1f)); } else { yield return(new WaitForSeconds(wave_start_wait)); } Peripheral.Instance.StartWave(); } if (Central.Instance.state == GameState.InGame && EagleEyes.Instance.events.transform.childCount > 0) { int max = EagleEyes.Instance.events.transform.childCount; for (int i = start_child; i < max; i++) { Transform child = EagleEyes.Instance.events.transform.GetChild(i).GetChild(0); start_child = i; if (!child.gameObject.activeSelf) { continue; } if (EagleEyes.Instance.events.transform.GetChild(i).gameObject.name.Contains("hint")) { continue; } if (EagleEyes.Instance.events.transform.GetChild(i).gameObject.name.Contains("enemy_description")) { continue; } Button button = child.gameObject.GetComponent <Button>(); if (!button) { continue; } button.onClick.Invoke(); } } if (Central.Instance.state == GameState.InGame && Moon.Instance.current_wave == Moon.Instance.Waves.Count) { if (take_snapshots) { TakeSnapshot(filename); } } yield return(new WaitForSeconds(0.1f)); } }
public void ChangeTime(TimeScale type) { if (type == TimeScale.Null) { return; } if (current_timeScale == type) { return; } if (EagleEyes.Instance.menu && type != TimeScale.Pause) { Debug.Log("Changing time while in menu to " + type + " is no good\n"); return; } // Debug.Log("Changing time: PREVIOUS: " + previous_timeScale + " CURRENT: " + current_timeScale + " CHANGING TO: " + type + "\n"); switch (type) { case TimeScale.Normal: setTimeScale(type); previous_timeScale = TimeScale.Normal; break; case TimeScale.Pause: previous_timeScale = (TimeScaleAbsolute(current_timeScale)) ? current_timeScale : TimeScale.Normal; setTimeScale(type); Noisemaker.Instance.Stop(); break; case TimeScale.Resume: previous_timeScale = (TimeScaleAbsolute(previous_timeScale)) ? previous_timeScale : TimeScale.Normal; setTimeScale(previous_timeScale); break; case TimeScale.Fast: previous_timeScale = (TimeScaleAbsolute(current_timeScale)) ? current_timeScale : TimeScale.Normal; setTimeScale(type); break; case TimeScale.SuperFastPress: previous_timeScale = (TimeScaleAbsolute(current_timeScale)) ? current_timeScale : TimeScale.Normal; setTimeScale(type); break; case TimeScale.Null: break; } current_timeScale = (TimeScaleAbsolute(type) || type == TimeScale.Pause) ? type : previous_timeScale; if (Central.Instance.state == GameState.InGame && (current_timeScale == TimeScale.Normal || current_timeScale == TimeScale.Fast || current_timeScale == TimeScale.SuperFastPress)) { Tracker.Log(PlayerEvent.TimeScaleChange, true, customAttributes: new Dictionary <string, string>() { { "attribute_1", current_timeScale.ToString() } }, customMetrics: null); } }