public void Remove(Type systemType, bool shouldNotify = false) { var system = GetBySystemType(systemType); if (system == null) { return; } _systems.Remove(system); _systems.Sort(); var drawableSystem = system as IDrawableSystem; if (drawableSystem != null) { _drawableSystems.Remove(drawableSystem); _drawableSystems.Sort(); } system.RemoveFromGameManager(_gameManager); if (!shouldNotify) { return; } SystemRemoved?.Invoke(this, new SystemRemovedEventArgs(system)); }
private void RegisterManagers() { // Entity events EntityManager.Register(this); EntityManager.EntityAdded += EntityManagerOnEntityAdded; EntityManager.EntityRemoved += EntityManagerOnEntityRemoved; EntityManager.ComponentAdded += EntityManagerOnComponentAdded; EntityManager.ComponentRemoved += EntityManagerOnComponentRemoved; // Systems events Systems.Register(this); Systems.SystemAdded += (sender, args) => SystemAdded?.Invoke(sender, args); Systems.SystemStarted += (sender, args) => SystemStarted?.Invoke(sender, args); Systems.SystemRemoved += (sender, args) => SystemRemoved?.Invoke(sender, args); Systems.SystemStopped += (sender, args) => SystemStopped?.Invoke(sender, args); }