private static void OnComponentRemoving(ComponentEventArgs args) { if (args.Component.Active) { ICmpInitializable cInit = args.Component as ICmpInitializable; if (cInit != null) { cInit.OnDeactivate(); } } if (ComponentRemoving != null) { ComponentRemoving(current, args); } }
private void objectManager_ComponentRemoving(object sender, ComponentEventArgs e) { this.RemoveFromManagers(e.Component); // If the scene is active, deactivate any removed components if (this.active && e.Component.Active) { ICmpInitializable cInit = e.Component as ICmpInitializable; if (cInit != null) { cInit.OnDeactivate(); } } // Fire global event for current main scene if (this.IsCurrent && ComponentRemoving != null) { ComponentRemoving(current, e); } }