private void OnDestroy() { Log.dbg("OnDestroy {0}", this.InstanceID); // The object can be destroyed before the full initialization cycle while KSP is booting, so we need to check first. if (null == this.notifier) { return; } this.notifier = null; }
private bool InitModule() { try { System.Type type = KSPe.Util.SystemTools.TypeFinder.FindByInterfaceName("TweakScaleCompanion.Frameworks.Waterfall.Integrator.Notifier"); System.Reflection.ConstructorInfo ctor = type.GetConstructor(new[] { typeof(Part), typeof(Listener) }); this.notifier = (Notifier)ctor.Invoke(new object[] { this.part, (Listener)this }); } catch (System.NullReferenceException e) { Log.error(this, e); return(true); // Not ready yet. Signal the caller that he will need to call us again. } return(false); // Everything is fine. Signal the caller to do not call us again. }