private IEnumerator Startup() { if (IsBeingDeleted) { yield break; } yield return(new WaitForEndOfFrame()); if (IsBeingDeleted) { yield break; } //Get the SeaBase _seaBase = gameObject?.transform?.parent?.gameObject; if (_seaBase == null) { ErrorMessage.AddMessage($"[{Information.ModName}] ERROR: Can not work out what base it was placed inside."); Log.Error("ERROR: Can not work out what base it was placed inside."); yield break; } AISolutions_Patcher.AddEventHandlerIfMissing(AlertedNewTurbinePlaced); JetStreamDestroy_Patcher.AddEventHandlerIfMissing(AlertedNewTurbineDestroyed); GetTurbines(); TurnDisplayOn(); }
private void Startup() { //Get the SeaBase _seaBase = gameObject?.transform?.parent?.gameObject; if (_seaBase == null) { ErrorMessage.AddMessage($"[MarineMonitor] ERROR: Can not work out what base it was placed inside."); QuickLogger.Error("ERROR: Can not work out what base it was placed inside."); return; } AIMarineTurbine_Patcher.AddEventHandlerIfMissing(AlertedNewTurbinePlaced); JetStreamDestroy_Patcher.AddEventHandlerIfMissing(AlertedNewTurbineDestroyed); GetTurbines(); TurnDisplayOn(); }
private void OnDestroy() { AIMarineTurbine_Patcher.RemoveEventHandler(AlertedNewTurbinePlaced); JetStreamDestroy_Patcher.RemoveEventHandler(AlertedNewTurbineDestroyed); }