Ejemplo n.º 1
0
 protected override void OnCreate()
 {
     createCubeGoQuery = GetEntityQuery(
         ComponentType.ReadOnly <RepCubeComponentData>(),
         ComponentType.Exclude <RepCubeGoCreated>());
     updateCubeGoQuery = GetEntityQuery(ComponentType.ReadOnly <RepCubeGoCreated>());
 }
Ejemplo n.º 2
0
 protected override void OnCreate()
 {
     _query = GetEntityQuery(
         ComponentType.ReadOnly <RotateDirectlyData>(),
         ComponentType.ReadOnly <ActorForceRotationData>(),
         ComponentType.Exclude <StopRotationData>());
 }
Ejemplo n.º 3
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        EntityQuery targetQuery = GetEntityQuery(typeof(Kobolt), ComponentType.ReadOnly <Translation>(), ComponentType.Exclude <DoNotTarget>());

        EntityQuery          unitQuery = GetEntityQuery(typeof(SeekComponent), ComponentType.Exclude <HasTarget>());
        NativeArray <Entity> closestTargetEntityArray = new NativeArray <Entity>(unitQuery.CalculateEntityCount(), Allocator.TempJob);

        FindTargetSectorSystemJob findTargetSectorSystemJob = new FindTargetSectorSystemJob
        {
            SectorMultiHashMap       = SectorSystem.SectorMultiHashMap,
            closestTargetEntityArray = closestTargetEntityArray,
        };
        JobHandle jobHandle = findTargetSectorSystemJob.Schedule(this, inputDeps);

        // Add HasTarget Component to Entities that have a Closest Target
        AddComponentJob addComponentJob = new AddComponentJob
        {
            closestTargetEntityArray = closestTargetEntityArray,
            entityCommandBuffer      = endSimulationEntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(),
        };

        jobHandle = addComponentJob.Schedule(this, jobHandle);

        endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(jobHandle);

        return(jobHandle);
    }
Ejemplo n.º 4
0
        protected override void OnCreate( )
        {
            Debug.Log("Start Add New Octree System");
            Debug.LogWarning("TODO: Replace instance with entity?");
            Debug.LogWarning("TODO: incomplete Get max bounds?");

            eiecb = World.GetOrCreateSystem <EndInitializationEntityCommandBufferSystem> ();

            group = GetEntityQuery
                    (
                typeof(AddNewOctreeData)
                    );

            octreeArchetype = EntityManager.CreateArchetype
                              (
                ComponentType.Exclude <IsActiveTag> (),

                typeof(AddNewOctreeData),
                typeof(RootNodeData),

                // Add buffers.
                typeof(NodeBufferElement),
                typeof(NodeChildrenBufferElement),
                typeof(NodeInstancesIndexBufferElement),
                typeof(NodeSparesBufferElement),
                typeof(InstanceBufferElement),
                typeof(InstancesSpareIndexBufferElement),
                typeof(AddInstanceBufferElement),
                typeof(RemoveInstanceBufferElement)
                              );
        }
Ejemplo n.º 5
0
    protected override void OnCreate()
    {
        _TweenRecord     = new List <Entity>();
        _MovementVectors = new List <Vector3>()
        {
            new Vector3(-1, 0, -1), // Bottom left
            new Vector3(0, 0, -1),  // Bottom
            new Vector3(1, 0, -1),  // Bottom Right
            new Vector3(-1, 0, 0),  // Left
            new Vector3(1, 0, 0),   // Right
            new Vector3(-1, 0, 1),  // Top Left
            new Vector3(0, 0, 1),   // Top
            new Vector3(1, 0, 1),   // Top Right
        };

        enemyQuery = GetEntityQuery(
            ComponentType.ReadOnly <Translation>(),
            ComponentType.ReadOnly <Rigidbody>(),
            ComponentType.ReadOnly <EnemyData>(),
            ComponentType.ReadOnly <HealthData>(),
            ComponentType.ReadOnly <CollisionData>(),
            ComponentType.Exclude <DeadData>());

        playerQuery = GetEntityQuery(
            ComponentType.ReadOnly <Translation>(),
            ComponentType.ReadOnly <PlayerData>(),
            ComponentType.ReadOnly <HealthData>());

        zoneQuery = GetEntityQuery(
            ComponentType.ReadOnly <Translation>(),
            ComponentType.ReadOnly <NonUniformScale>(),
            ComponentType.ReadOnly <ZoneData>());
    }
Ejemplo n.º 6
0
        protected override void OnCreate()
        {
            m_GhostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>();

            m_ghostEntityMap        = new NativeHashMap <int, Entity>(2048, Allocator.Persistent);
            m_spawnedGhostEntityMap = new NativeHashMap <SpawnedGhost, Entity>(2048, Allocator.Persistent);

            playerGroup = GetEntityQuery(
                ComponentType.ReadWrite <NetworkStreamConnection>(),
                ComponentType.ReadOnly <NetworkStreamInGame>(),
                ComponentType.Exclude <NetworkStreamDisconnected>());

            ghostCleanupGroup = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(),
                                               ComponentType.Exclude <PreSpawnedGhostId>());

            clearJobGroup = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(),
                                           ComponentType.Exclude <PreSpawnedGhostId>());

            m_Barrier          = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>();
            m_CompressionModel = new NetworkCompressionModel(Allocator.Persistent);
#if UNITY_EDITOR || DEVELOPMENT_BUILD
            m_StatsCollection = World.GetOrCreateSystem <GhostStatsCollectionSystem>();
#endif
            m_GhostDespawnSystem = World.GetOrCreateSystem <GhostDespawnSystem>();

            RequireSingletonForUpdate <GhostPrefabCollectionComponent>();
            m_ReceivedGhostVersion = new NativeArray <ulong>(1, Allocator.Persistent);
            m_GhostCompletionCount = new NativeArray <int>(2, Allocator.Persistent);
        }
Ejemplo n.º 7
0
        public static BlobAssetReference <MarketMatrix> Main(BlobAssetReference <ProvToState> provToState)
        {
            var em = World.DefaultGameObjectInjectionWorld.EntityManager;

            var pmi = MarketConvert.Main(JsonConvert.DeserializeObject <MarketJson>(
                                             File.ReadAllText(Path.Combine(Application.streamingAssetsPath, "Custom", "Agents", "Pop.json"))));

            // DEBUG: 6 hardcoded!
            using var provinces =
                      // Ocean doesn't have cores. Or tagged province.
                      em.CreateEntityQuery(typeof(Province), typeof(Cores), ComponentType.Exclude <OceanCountry>(),
                                           ComponentType.Exclude <UncolonizedCountry>()).ToEntityArray(Allocator.TempJob);
            foreach (var province in provinces)
            {
                var rand = Random.Range(5, 11); // 5 to 10 different types of pops.
                for (var i = 0; i < rand; i++)
                {
                    em.GetBuffer <Population>(province).Add(new Population
                    {
                        // Maximum factory employment is 1000.
                        Quantity = Random.Range(400, 800),
                        Employed = 0,
                        Wealth   = Random.Range(100, 200)
                    });
                }
            }

            return(pmi);
        }
Ejemplo n.º 8
0
        protected override void OnCreate( )
        {
            becb = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem> ();

            group_MMMamager = EntityManager.CreateEntityQuery
                              (
                ComponentType.ReadOnly <IsAliveTag> (),
                ComponentType.ReadOnly <NNManagerComponent> (),

                ComponentType.Exclude <NNMangerIsSpawningNewGenerationTag> ()
                              );

            group_finishedPopulation = EntityManager.CreateEntityQuery
                                       (
                ComponentType.ReadOnly <IsAliveTag> (),
                // ComponentType.ReadOnly <NNIsFinishedTag> (), ...

                ComponentType.ReadOnly <NNBrainTag> (),
                ComponentType.ReadOnly <NNIsFinishedTag> (),
                // ComponentType.ReadOnly <NNIsFinishedTag> (),
                ComponentType.Exclude <NNIsPreviousGenerationTag> (),
                ComponentType.Exclude <NNIsFirstGenerationTag> (),

                ComponentType.ReadWrite <NNManagerSharedComponent> ()
                                       );
        }
Ejemplo n.º 9
0
        protected override void OnCreate()
        {
            m_NewGhosts        = new NativeList <T>(16, Allocator.Persistent);
            m_NewGhostIds      = new NativeList <int>(16, Allocator.Persistent);
            m_InitialArchetype = EntityManager.CreateArchetype(ComponentType.ReadWrite <T>(),
                                                               ComponentType.ReadWrite <GhostComponent>());

            m_GhostUpdateSystemGroup = World.GetOrCreateSystem <GhostUpdateSystemGroup>();
            m_GhostMap           = m_GhostUpdateSystemGroup.GhostEntityMap;
            m_ConcurrentGhostMap = m_GhostMap.AsParallelWriter();
            m_DestroyGroup       = GetEntityQuery(ComponentType.ReadOnly <T>(),
                                                  ComponentType.Exclude <GhostComponent>(),
                                                  ComponentType.Exclude <PredictedGhostSpawnRequestComponent>());
            m_SpawnRequestGroup = GetEntityQuery(ComponentType.ReadOnly <T>(),
                                                 ComponentType.ReadOnly <PredictedGhostSpawnRequestComponent>());
            m_PlayerGroup = GetEntityQuery(ComponentType.ReadOnly <NetworkStreamConnection>(),
                                           ComponentType.ReadOnly <NetworkIdComponent>(), ComponentType.Exclude <NetworkStreamDisconnected>());

            m_InvalidGhosts                 = new NativeList <Entity>(1024, Allocator.Persistent);
            m_DelayedSpawnQueue             = new NativeQueue <DelayedSpawnGhost>(Allocator.Persistent);
            m_CurrentDelayedSpawnList       = new NativeList <DelayedSpawnGhost>(1024, Allocator.Persistent);
            m_ConcurrentDelayedSpawnQueue   = m_DelayedSpawnQueue.AsParallelWriter();
            m_PredictedSpawnQueue           = new NativeQueue <DelayedSpawnGhost>(Allocator.Persistent);
            m_CurrentPredictedSpawnList     = new NativeList <DelayedSpawnGhost>(1024, Allocator.Persistent);
            m_ConcurrentPredictedSpawnQueue = m_PredictedSpawnQueue.AsParallelWriter();
            m_Barrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            m_PredictSpawnGhosts        = new NativeList <PredictSpawnGhost>(16, Allocator.Persistent);
            m_PredictionSpawnCleanupMap = new NativeHashMap <int, int>(16, Allocator.Persistent);

            m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>();
        }
Ejemplo n.º 10
0
 protected override void OnCreate()
 {
     m_MissingRenderBounds = GetEntityQuery(
         ComponentType.Exclude <Frozen>(),
         ComponentType.Exclude <RenderBounds>(),
         ComponentType.ReadWrite <RenderMesh>());
 }
Ejemplo n.º 11
0
        protected override void OnCreate()
        {
            _updateQuery = GetEntityQuery(
                new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <AIAgent>(), ComponentType.ReadOnly <RaycastResult>()
                },
                None = new[] { ComponentType.ReadWrite <RaycastResultState>() }
            }
                );

            _updateQueryNoState = GetEntityQuery(
                new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <AIAgent>(), ComponentType.ReadOnly <RaycastResult>(), ComponentType.ReadWrite <RaycastResultState>(),
                },
            }
                );

            _cleanupQuery = GetEntityQuery(ComponentType.ReadOnly <RaycastResultState>(),
                                           ComponentType.Exclude <AIAgent>());

            _commandBufferSystem = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        }
        protected override void OnCreate()
        {
            //@TODO: Support SetFilter with EntityQueryDesc syntax

            m_FrozenGroup = GetEntityQuery(
                ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                ComponentType.ReadOnly <WorldRenderBounds>(),
                ComponentType.ReadOnly <LocalToWorld>(),
                ComponentType.ReadOnly <RenderMesh>(),
                ComponentType.ReadOnly <FrozenRenderSceneTag>()
                );
            m_DynamicGroup = GetEntityQuery(
                ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                ComponentType.Exclude <FrozenRenderSceneTag>(),
                ComponentType.ReadOnly <WorldRenderBounds>(),
                ComponentType.ReadOnly <LocalToWorld>(),
                ComponentType.ReadOnly <RenderMesh>()
                );

            // This component group must include all types that are being used by the culling job
            m_CullingJobDependencyGroup = GetEntityQuery(
                ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                ComponentType.ReadOnly <RootLodRequirement>(),
                ComponentType.ReadOnly <LodRequirement>(),
                ComponentType.ReadOnly <WorldRenderBounds>()
                );

            m_InstancedRenderMeshBatchGroup =
                new InstancedRenderMeshBatchGroup(EntityManager, this, m_CullingJobDependencyGroup);
            m_SubsceneTagVersion          = new NativeHashMap <FrozenRenderSceneTag, int>(1000, Allocator.Persistent);
            m_LastKnownSubsceneTagVersion = new NativeList <SubSceneTagOrderVersion>(Allocator.Persistent);
        }
Ejemplo n.º 13
0
 public LiveLinkSceneChangeTracker(EntityManager manager)
 {
     _LoadedScenesQuery      = manager.CreateEntityQuery(typeof(SceneReference));
     _UnloadedScenesQuery    = manager.CreateEntityQuery(ComponentType.Exclude <SceneReference>(), ComponentType.ReadOnly <LiveLinkPatcher.LiveLinkedSceneState>());
     m_PreviousScenes        = new NativeList <SceneReference>(Allocator.Persistent);
     m_PreviousRemovedScenes = new NativeList <LiveLinkPatcher.LiveLinkedSceneState>(Allocator.Persistent);
 }
Ejemplo n.º 14
0
    protected override void OnCreate()
    {
        base.OnCreate();
        _appConfig    = ClientBootstrapper.Container.Resolve <AppConfig>();
        _config       = ClientBootstrapper.Container.Resolve <MainConfig>();
        _fxData       = ClientBootstrapper.Container.Resolve <FXData>();
        _uiController = ClientBootstrapper.Container.Resolve <UIController>();

        _group = GetEntityQuery(
            ComponentType.ReadWrite <CharacterPresenter>(),
            ComponentType.ReadOnly <GameObject>(),
            ComponentType.ReadOnly <CharactersBindData>(),
            ComponentType.ReadOnly <Translation>(),
            ComponentType.ReadOnly <Attack>(),
            ComponentType.ReadOnly <Damage>(),
            ComponentType.ReadOnly <PlayerData>(),
            ComponentType.Exclude <DEAD>()
            );

        _otherPlayers = GetEntityQuery(
            ComponentType.ReadWrite <PlayerData>(),
            ComponentType.ReadOnly <Damage>(),
            ComponentType.ReadOnly <Translation>(),
            ComponentType.Exclude <PlayerInput>(),
            ComponentType.Exclude <DEAD>()
            );
    }
Ejemplo n.º 15
0
 protected override void OnCreate()
 {
     m_clientConnectionGroup = GetEntityQuery(
         ComponentType.ReadWrite <NetworkStreamConnection>(),
         ComponentType.Exclude <NetworkStreamDisconnected>());
     ClientConnectionState = ConnectionState.Uninitialized;
 }
Ejemplo n.º 16
0
 protected override void OnCreate()
 {
     connectionQuery = GetEntityQuery(
         typeof(NetworkIdComponent),
         ComponentType.Exclude <NetworkStreamInGame>()
         );
 }
Ejemplo n.º 17
0
 protected override void OnCreate()
 {
     m_NetworkConnection = GetEntityQuery(
         ComponentType.ReadOnly <NetworkIdComponent>(),
         ComponentType.ReadWrite <LevelLoadingTag>(),
         ComponentType.Exclude <NetworkStreamInGame>());
 }
 protected override void OnCreate()
 {
     base.OnCreate();
     m_entityQuery = GetEntityQuery(ComponentType.ReadWrite <Voxel>(), ComponentType.ReadWrite <ChunkModification>(),
                                    ComponentType.Exclude <ApplyMesh>(), ComponentType.Exclude <TriangulateChunk>());
     m_barrier = World.GetOrCreateSystem <EndInitializationEntityCommandBufferSystem>();
 }
Ejemplo n.º 19
0
        /// <inheritdoc />
        protected override void OnCreate()
        {
            InitSpatialHashing();

            _addGroup    = GetEntityQuery(ComponentType.ReadWrite <T>(), ComponentType.Exclude <TY>());
            _updateGroup = GetEntityQuery(ComponentType.ReadWrite <T>(), ComponentType.ReadOnly <TY>(), ComponentType.ReadOnly <TZ>());
            _removeGroup = GetEntityQuery(ComponentType.Exclude <T>(), ComponentType.ReadOnly <TY>());
        }
Ejemplo n.º 20
0
 protected override void OnCreateManager()
 {
     player = GetEntityQuery(
         ComponentType.Exclude(typeof(CollidedWithGround)),
         typeof(Player),
         typeof(Animator)
         );
 }
Ejemplo n.º 21
0
 protected override void OnCreate()
 {
     _query = GetEntityQuery(
         ComponentType.ReadOnly <Transform>(),
         ComponentType.ReadOnly <ActorRotationByLookInputData>(),
         ComponentType.ReadOnly <PlayerInputData>(),
         ComponentType.Exclude <StopRotationData>());
 }
Ejemplo n.º 22
0
 protected override void OnCreate()
 {
     _query = GetEntityQuery(
         ComponentType.ReadOnly <AbilityForceMovement>(),
         ComponentType.ReadOnly <ActorMovementData>(),
         ComponentType.ReadOnly <ActorForceMovementData>(),
         ComponentType.Exclude <StopMovementData>());
 }
Ejemplo n.º 23
0
 protected override void OnCreate()
 {
     query = GetEntityQuery(
         ComponentType.ReadOnly <Rotation>(),
         ComponentType.ReadOnly <PlayerData>(),
         ComponentType.ReadOnly <Rigidbody>(),
         ComponentType.Exclude <DeadData>());
 }
Ejemplo n.º 24
0
 protected override void OnCreate()
 {
     _query = GetEntityQuery(
         ComponentType.ReadWrite <Weapon>(),
         ComponentType.Exclude <Firing>());
     _barrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     Enabled  = false;
 }
 protected override void OnCreate()
 {
     query = GetEntityQuery(
         ComponentType.ReadOnly <Transform>(),
         ComponentType.ReadOnly <PlayerInputData>(),
         ComponentType.ReadOnly <Rigidbody>(),
         ComponentType.Exclude <DeadData>());
 }
Ejemplo n.º 26
0
    protected override void OnCreateManager()
    {
        destroyGroup = GetComponentGroup(ComponentType.ReadWrite <GhostShipState>(),
                                         ComponentType.Exclude <ShipSnapshotData>()); // FIXME: should keep until there is no more available snapshot data in the case of interpolation

        playerGroup = GetComponentGroup(ComponentType.ReadWrite <PlayerStateComponentData>(), ComponentType.ReadOnly <NetworkIdComponent>());
        m_Barrier   = World.GetExistingManager <BeginSimulationEntityCommandBufferSystem>();
    }
Ejemplo n.º 27
0
    protected override void OnCreateManager()
    {
        base.OnCreateManager();


        PredictedProjectileGroup = GetEntityQuery(typeof(ProjectileData), typeof(PredictedProjectile), ComponentType.Exclude <DespawningEntity>());
        IncommingProjectileGroup = GetEntityQuery(typeof(ProjectileData), ComponentType.Exclude <ClientProjectileOwner>());
    }
Ejemplo n.º 28
0
    protected override void OnCreate()
    {
        cmdTargetGroup = GetEntityQuery(
            ComponentType.ReadWrite <CommandTargetComponent>(),
            ComponentType.Exclude <NetworkStreamDisconnected>());

        m_TimeSystem = World.GetOrCreateSystem <NetworkTimeSystem>();
    }
    protected override void OnCreate()
    {
        base.OnCreate();
        m_DestroyGroup = GetEntityQuery(ComponentType.ReadWrite <GhostShipState>(),
                                        ComponentType.Exclude <ShipSnapshotData>());

        m_Barrier = World.GetExistingSystem <BeginSimulationEntityCommandBufferSystem>();
    }
Ejemplo n.º 30
0
 protected override void OnCreate()
 {
     m_LocalPlayer = GetEntityQuery(
         ComponentType.ReadOnly <Translation>(),
         ComponentType.ReadOnly <PlayerInputData>(),
         ComponentType.ReadOnly <Rigidbody>(),
         ComponentType.Exclude <DeadData>());
 }