Exemple #1
0
        // todo: вынести создание в фабрику
        public SystemReactor(ISystemExecutor systemExecutor, HashSet <Type> targetTypes)
        {
            _systemExecutor = systemExecutor;
            TargetTypesSet  = targetTypes;
            TargetTypesList = targetTypes.ToList();

            _componentIndex = new ComponentIndex(targetTypes.ToList());
            _componentIndex.Build();

            _inConnectionIndex  = new ConnectionIndex(targetTypes.ToList());
            _outConnectionIndex = new ConnectionIndex(targetTypes.ToList());

            var systems = _systemExecutor.Systems
                          .Where(x => x.TargetGroup.TargettedComponents.Any() && x.TargetGroup.TargettedComponents.All(targetTypes.Contains))
                          .ToList();

            GroupAccessors = _systemExecutor.PoolManager.PoolAccessors
                             .Where(x => new HashSet <Type>(x.AccessorToken.ComponentTypes).IsSubsetOf(targetTypes))
                             .ToArray();

            SetupSystems            = systems.OfType <ISetupSystem>().OrderByPriority().ToArray();
            EntityReactionSystems   = systems.OfType <IEntityReactionSystem>().OrderByPriority().ToArray();
            GroupReactionSystems    = systems.OfType <IGroupReactionSystem>().OrderByPriority().ToArray();
            InteractReactionSystems = systems.OfType <IInteractReactionSystem>().OrderByPriority().ToArray();
            TeardownSystems         = systems.OfType <ITeardownSystem>().OrderByPriority().ToArray();

            HasGroupOrSystems = systems.Count > 0 || GroupAccessors.Length > 0;
        }
Exemple #2
0
 public DefaultPoolFactory(IEntityFactory entityFactory, IEventSystem eventSystem, IEntityIndexPool entityIndexPool, ISystemExecutor systemExecutor)
 {
     _entityFactory   = entityFactory;
     _eventSystem     = eventSystem;
     _entityIndexPool = entityIndexPool;
     _systemExecutor  = systemExecutor;
 }
Exemple #3
0
 public Pool(string name, IEntityFactory entityFactory, IEntityIndexPool indexPool, ISystemExecutor executor, IEventSystem eventSystem)
 {
     _indexPool    = indexPool;
     _executor     = executor;
     _entities     = new HashSet <IEntity>();
     Name          = name;
     EventSystem   = eventSystem;
     EntityFactory = entityFactory;
 }
 private void Init(DiContainer container, ISystemExecutor systemExecutor, ICoreManager coreManager, IPoolManager poolManager)
 {
     Plugins        = new List <IReactorPlugin>();
     SystemExecutor = systemExecutor;
     PoolManager    = poolManager;
     //CoreManager = coreManager;
     Container = container;
     ApplicationStarting();
     RegisterAllPluginDependencies();
     SetupAllPluginSystems();
     ApplicationStarted();
 }
Exemple #5
0
        public SystemReactor(ISystemExecutor systemExecutor, HashSet <Type> targetTypes)
        {
            _systemExecutor = systemExecutor;
            TargetTypes     = targetTypes;

            var systems = _systemExecutor.Systems.Where(x => x.TargetGroup.TargettedComponents.All(targetTypes.Contains)).ToList();

            SetupSystems            = systems.OfType <ISetupSystem>().OrderByPriority().ToArray();
            EntityReactionSystems   = systems.OfType <IEntityReactionSystem>().OrderByPriority().ToArray();
            GroupReactionSystems    = systems.OfType <IGroupReactionSystem>().OrderByPriority().ToArray();
            InteractReactionSystems = systems.OfType <IInteractReactionSystem>().OrderByPriority().ToArray();
            TeardownSystems         = systems.OfType <ITeardownSystem>().OrderByPriority().ToArray();
        }
 public CoreManager(IPoolManager poolManager, ISystemHandlerManager handlerManager, ISystemExecutor systemExecutor)
 {
     PoolManager    = poolManager;
     HandlerManager = handlerManager;
     systemExecutor.Start(this);
 }