private void OnValueChange(bool oldValue, bool newValue) { try { if (oldValue == newValue) { return; } if (newValue) { if (CurrentWorldChecked == false) { MelonCoroutines.Start(RiskFunct.CheckWorld()); } coroutine = MelonCoroutines.Start(AutoSet()); } else { if (!coroutine?.Equals(null) ?? false) { MelonCoroutines.Stop(coroutine); } Utils.SetImmobilize(false); } } catch (System.Exception ex) { Logger.Error("Error in starting/stopping coroutine:\n" + ex.ToString()); } }
public override void OnSceneWasLoaded(int buildIndex, string sceneName) { switch (buildIndex) { case -1: qmButtOveride = false; WorldTypeGame = false; CurrentWorldChecked = false; if (movementToggle.Value) { MelonCoroutines.Start(RiskFunct.CheckWorld()); } break; default: break; } }