private void OnDestroy() { if (_instance == this) { _instance = null; } OnWidgetSelect.RemoveListener(new UnityAction <TrackingStationWidget>(OnWidgetSelected)); OnWidgetAwake.RemoveListener(new UnityAction <TrackingStationWidget>(OnWidgetAwaken)); GameEvents.onNewVesselCreated.Remove(new EventData <Vessel> .OnEvent(OnVesselCreate)); GameEvents.onVesselDestroy.Remove(new EventData <Vessel> .OnEvent(OnVesselDestroy)); GameEvents.onKnowledgeChanged.Remove(new EventData <GameEvents.HostedFromToAction <IDiscoverable, DiscoveryLevels> > .OnEvent(OnKnowledgeChange)); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); return; } _instance = this; OnWidgetSelect.AddListener(new UnityAction <TrackingStationWidget>(OnWidgetSelected)); OnWidgetAwake.AddListener(new UnityAction <TrackingStationWidget>(OnWidgetAwaken)); GameEvents.onNewVesselCreated.Add(new EventData <Vessel> .OnEvent(OnVesselCreate)); GameEvents.onVesselDestroy.Add(new EventData <Vessel> .OnEvent(OnVesselDestroy)); GameEvents.onKnowledgeChanged.Add(new EventData <GameEvents.HostedFromToAction <IDiscoverable, DiscoveryLevels> > .OnEvent(OnKnowledgeChange)); _CurrentMode = (Tracking_Mode)Tracking_Persistence.SortMode; StartCoroutine(WaitForTrackingStation()); }