示例#1
0
        public SystemExecutor(IPoolManager poolManager, IEventSystem eventSystem,
                              IReactToEntitySystemHandler reactToEntitySystemHandler, IReactToGroupSystemHandler reactToGroupSystemHandler,
                              ISetupSystemHandler setupSystemHandler, IReactToDataSystemHandler reactToDataSystemHandler,
                              IManualSystemHandler manualSystemHandler)
        {
            PoolManager = poolManager;
            EventSystem = eventSystem;
            ReactToEntitySystemHandler = reactToEntitySystemHandler;
            ReactToGroupSystemHandler  = reactToGroupSystemHandler;
            SetupSystemHandler         = setupSystemHandler;
            ReactToDataSystemHandler   = reactToDataSystemHandler;
            ManualSystemHandler        = manualSystemHandler;

            var addEntitySubscription       = EventSystem.Receive <EntityAddedEvent>().Subscribe(OnEntityAddedToPool);
            var removeEntitySubscription    = EventSystem.Receive <EntityRemovedEvent>().Subscribe(OnEntityRemovedFromPool);
            var addComponentSubscription    = EventSystem.Receive <ComponentAddedEvent>().Subscribe(OnEntityComponentAdded);
            var removeComponentSubscription = EventSystem.Receive <ComponentRemovedEvent>().Subscribe(OnEntityComponentRemoved);

            _systems             = new List <ISystem>();
            _systemSubscriptions = new Dictionary <ISystem, IList <SubscriptionToken> >();
            _eventSubscriptions  = new List <IDisposable>
            {
                addEntitySubscription, removeEntitySubscription, addComponentSubscription, removeComponentSubscription
            };
        }
        public SystemExecutor(
            IPoolManager poolManager,
            IEventSystem eventSystem,
            IEntityReactionSystemHandler entityReactionSystemHandler,
            IGroupReactionSystemHandler groupReactionSystemHandler,
            ISetupSystemHandler setupSystemHandler,
            IInteractReactionSystemHandler interactReactionSystemHandler,
            IManualSystemHandler manualSystemHandler)
        {
            PoolManager = poolManager;
            EventSystem = eventSystem;
            EntityReactionSystemHandler   = entityReactionSystemHandler;
            GroupReactionSystemHandler    = groupReactionSystemHandler;
            SetupSystemHandler            = setupSystemHandler;
            InteractReactionSystemHandler = interactReactionSystemHandler;
            ManualSystemHandler           = manualSystemHandler;

            var addEntitySubscription       = EventSystem.Receive <EntityAddedEvent>().Subscribe(OnEntityAddedToPool);
            var removeEntitySubscription    = EventSystem.Receive <EntityRemovedEvent>().Subscribe(OnEntityRemovedFromPool);
            var addComponentSubscription    = EventSystem.Receive <ComponentAddedEvent>().Subscribe(OnEntityComponentAdded);
            var removeComponentSubscription = EventSystem.Receive <ComponentRemovedEvent>().Subscribe(OnEntityComponentRemoved);

            _systems = new List <ISystem>();
            _entitySubscribtionsOnSystems = new Dictionary <ISystem, Dictionary <IEntity, SubscriptionToken> >();
            _nonEntitySubscriptions       = new Dictionary <ISystem, SubscriptionToken>();
            _eventSubscriptions           = new List <IDisposable>
            {
                addEntitySubscription,
                removeEntitySubscription,
                addComponentSubscription,
                removeComponentSubscription
            };
        }
 public SystemHandlerManager(
     IEntityReactionSystemHandler entityReactionSystemHandler,
     IGroupReactionSystemHandler groupReactionSystemHandler,
     ISetupSystemHandler setupSystemHandler,
     IInteractReactionSystemHandler interactReactionSystemHandler,
     IManualSystemHandler manualSystemHandler)
 {
     EntityReactionSystemHandler   = entityReactionSystemHandler;
     GroupReactionSystemHandler    = groupReactionSystemHandler;
     SetupSystemHandler            = setupSystemHandler;
     InteractReactionSystemHandler = interactReactionSystemHandler;
     ManualSystemHandler           = manualSystemHandler;
 }