Example #1
0
        protected override void OnCreate()
        {
            RequireSingletonForUpdate <MapRenderTerminal>();
            RequireSingletonForUpdate <Map>();

            _renderableActors = GetEntityQuery(
                ComponentType.ReadOnly <Position>(),
                ComponentType.ReadOnly <Renderable>(),
                ComponentType.ReadOnly <Actor>());

            _renderableItems = GetEntityQuery(
                ComponentType.ReadOnly <Position>(),
                ComponentType.ReadOnly <Renderable>(),
                ComponentType.ReadOnly <Item>());

            _actorsMovedQuery = GetEntityQuery(
                ComponentType.ReadOnly <Position>()
                );
            _actorsMovedQuery.AddChangedVersionFilter(ComponentType.ReadOnly <Position>());

            _gameStateChanged = GetEntityQuery(
                ComponentType.ReadOnly <GameState>());
            _gameStateChanged.AddChangedVersionFilter(typeof(GameState));

            _terminalChangedQuery = GetEntityQuery(
                ComponentType.ReadOnly <MapRenderTerminal>(),
                ComponentType.ReadOnly <TerminalTilesBuffer>());
            _terminalChangedQuery.AddChangedVersionFilter(typeof(TerminalTilesBuffer));

            _terminalDirtyQuery = GetEntityQuery(ComponentType.ReadOnly <MapRenderTerminal>(),
                                                 ComponentType.ReadOnly <Terminal>());
            _terminalDirtyQuery.AddChangedVersionFilter(typeof(Terminal));

            _lastRenderableCount = _renderableActors.CalculateEntityCount();
        }
Example #2
0
 protected override void OnCreate()
 {
     RequireSingletonForUpdate <GameStateShowInventory>();
     _barrier = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     _gameStateChangedQuery = GetEntityQuery(ComponentType.ReadOnly <GameState>(),
                                             ComponentType.ReadOnly <GameStateShowInventory>());
     _gameStateChangedQuery.AddChangedVersionFilter(typeof(GameStateShowInventory));
 }
Example #3
0
 protected override void OnCreate()
 {
     base.OnCreate();
     _bufferSystem         = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     worldMapViewDataQuery = GetEntityQuery(ComponentType.ReadOnly <WorldMapViewData>());
     worldMapTiles         = GetEntityQuery(ComponentType.ReadOnly <WorldMapTileData>());
     _tileArchetype        = EntityManager.CreateArchetype(typeof(LocalToWorld), typeof(Translation), typeof(WorldMapTileData), typeof(Rotation));
     outOfViewQuery        = GetEntityQuery(typeof(WorldMapTileOutOfView));
     viewChangedQuery      = GetEntityQuery(ComponentType.ReadOnly <WorldMapViewData>(), typeof(WorldMapViewSystemData));
     viewChangedQuery.AddChangedVersionFilter(typeof(WorldMapViewData));
 }
    protected override void OnCreate()
    {
        base.OnCreate();
        m_EndSimulationEntityCommandBufferSystem = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        m_KillQuery = GetEntityQuery(new ComponentType[]
        {
            ComponentType.ReadOnly <C_Unit>(),
            ComponentType.ReadOnly <T_IsDead>(),
        });

        m_KillQuery.AddChangedVersionFilter(ComponentType.ReadOnly <T_IsDead>());
    }
        protected override void OnCreate()
        {
            _mapQuery = GetEntityQuery(
                ComponentType.ReadWrite <MapTiles>(),
                ComponentType.ReadOnly <MapData>()
                );

            _moveQuery = GetEntityQuery(
                ComponentType.ReadWrite <Position>(),
                ComponentType.ReadOnly <Movement>()
                );

            _moveQuery.AddChangedVersionFilter(typeof(Movement));
        }
Example #6
0
        protected override void OnCreate()
        {
            _mapQuery = GetEntityQuery(
                ComponentType.ReadWrite <MapTiles>(),
                ComponentType.ReadOnly <MapData>()
                );

            _playerQuery = GetEntityQuery(
                ComponentType.ReadWrite <Position>(),
                ComponentType.ReadOnly <PlayerInput>(),
                ComponentType.ReadOnly <Player>());

            _playerQuery.AddChangedVersionFilter(ComponentType.ReadWrite <PlayerInput>());
            RequireForUpdate(_playerQuery);
        }
Example #7
0
        protected override void OnCreate()
        {
            _memoryQuery = GetEntityQuery(
                ComponentType.ReadOnly <TilesInView>(),
                ComponentType.ReadWrite <TilesInMemory>()
                );

            _mapQuery = GetEntityQuery(
                ComponentType.ReadOnly <MapData>(),
                ComponentType.Exclude <GenerateMap>()
                );

            _memoryQuery.AddChangedVersionFilter(
                ComponentType.ReadOnly <TilesInView>()
                );
        }
        protected override void OnUpdate()
        {
            m_query.ResetFilter();
            Dependency = Physics.BuildCollisionLayer(m_query, this).ScheduleParallel(out CollisionLayer layer, Allocator.Persistent, Dependency);
            var wcl = new WallCollisionLayer {
                layer = layer
            };

            if (sceneBlackboardEntity.HasCollectionComponent <WallCollisionLayer>())
            {
                sceneBlackboardEntity.SetCollectionComponentAndDisposeOld(wcl);
            }
            else
            {
                CompleteDependency();
                sceneBlackboardEntity.AddCollectionComponent(wcl);
            }
            m_query.AddChangedVersionFilter(typeof(LocalToWorld));
        }
Example #9
0
        protected override void OnCreate()
        {
            RequireSingletonForUpdate <MapObstaclesBuffer>();
            RequireSingletonForUpdate <MapEntitiesBuffer>();

            _movedActors = GetEntityQuery(
                ComponentType.ReadOnly <Position>(),
                ComponentType.ReadOnly <PathBlocker>());
            _movedActors.AddChangedVersionFilter(typeof(Position));

            _mapChanged = GetEntityQuery(
                ComponentType.ReadOnly <MapTilesBuffer>(),
                ComponentType.ReadOnly <MapSize>());
            _mapChanged.AddChangedVersionFilter(typeof(MapTilesBuffer));

            _actorsOnMap = EntityManager.CreateEntityQuery(
                ComponentType.ReadOnly <Position>(),
                ComponentType.ReadOnly <PathBlocker>()
                );
        }
    protected override void OnCreate()
    {
        base.OnCreate();
        m_EnemyUnitQuery = GetEntityQuery(new ComponentType[]
        {
            ComponentType.ReadOnly <C_Unit>(),
            ComponentType.ReadOnly <T_Enemy>(),
        });

        m_PlayerUnitQuery = GetEntityQuery(new ComponentType[]
        {
            ComponentType.ReadOnly <C_Unit>(),
            ComponentType.ReadOnly <T_Ally>(),
        });

        m_KillQuery = GetEntityQuery(new ComponentType[]
        {
            ComponentType.ReadOnly <C_Unit>(),
            ComponentType.ReadOnly <T_Enemy>(),
            ComponentType.ReadOnly <T_IsDead>(),
        });

        m_KillQuery.AddChangedVersionFilter(ComponentType.ReadOnly <T_IsDead>());
    }
Example #11
0
        protected override void OnCreate()
        {
            m_RootsGroup = GetEntityQuery(new EntityQueryDesc
            {
                All  = new ComponentType[] { ComponentType.ReadOnly <ChildTime>(), ComponentType.ReadOnly <TimeScale>() },
                None = new ComponentType[] { typeof(ParentTime) }
            });

            m_TimeScaleWriteGroupMaskLocalParent = EntityManager.GetEntityQueryMask(GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <ParentTime>(),
                    ComponentType.ReadWrite <TimeScale>(),
                    ComponentType.ReadOnly <LocalTimeScale>()
                },
                Options = EntityQueryOptions.FilterWriteGroup
            }));

            m_TimeScaleWriteGroupMaskParent = EntityManager.GetEntityQueryMask(GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <ParentTime>(),
                    ComponentType.ReadWrite <TimeScale>(),
                },
                Options = EntityQueryOptions.FilterWriteGroup
            }));

            AnyRootChangeQueryLocal = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <ChildTime>(),
                    ComponentType.ReadOnly <LocalTimeScale>(),
                },
            });
            AnyRootChangeQueryLocal.AddChangedVersionFilter(typeof(LocalTimeScale));

            AnyRootChangeQuery = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <ChildTime>(),
                    ComponentType.ReadOnly <TimeScale>(),
                },
            });
            AnyRootChangeQuery.AddChangedVersionFilter(typeof(TimeScale));


            AnyChildChangeQuery = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <ParentTime>(),
                    ComponentType.ReadOnly <TimeScale>(),
                },
            });
            AnyChildChangeQuery.AddChangedVersionFilter(typeof(ParentTime));
            AnyChildChangeQuery.AddChangedVersionFilter(typeof(TimeScale));

            AnyChildChangeQueryLocal = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <ParentTime>(),
                    ComponentType.ReadOnly <LocalTimeScale>(),
                },
            });
            AnyChildChangeQueryLocal.AddChangedVersionFilter(typeof(ParentTime));
            AnyChildChangeQueryLocal.AddChangedVersionFilter(typeof(LocalTimeScale));
        }