Пример #1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var ecb = m_BeginPresentationEcbSystem.CreateCommandBuffer().ToConcurrent();

            PayMaintenance payMaintenance = new PayMaintenance()
            {
                environmentSettings = Environment.environmentSettings,
                ecb = ecb
            };
            JobHandle jobHandle = payMaintenance.Schedule(m_Group, inputDeps);

            m_BeginPresentationEcbSystem.AddJobHandleForProducer(jobHandle);
            jobHandle.Complete();
            DestroyPetals destroyPetals = new DestroyPetals()
            {
                environmentSettings = Environment.environmentSettings,
                ecb = ecb
            };

            jobHandle = destroyPetals.Schedule(petalGroup, jobHandle);
            m_BeginPresentationEcbSystem.AddJobHandleForProducer(jobHandle);
            jobHandle.Complete();

            return(jobHandle);
        }
Пример #2
0
        protected override JobHandle OnUpdate(JobHandle inputDep)
        {
            int spawnCount = 0;
            int cnt;

            while (spawnCountQueue.TryDequeue(out cnt))
            {
                spawnCount += cnt;
            }
            SetSingleton(new ParticleSpawnCountComponent {
                spawnCount = spawnCount
            });
            var commandBuffer = barrier.CreateCommandBuffer().ToConcurrent();
            var spawnJob      = new ParticleSpawnJob();

            spawnJob.spawnCountQueue = spawnCountQueue.ToConcurrent();
            spawnJob.commandBuffer   = commandBuffer;
            spawnJob.deltaTime       = Time.deltaTime;
            spawnJob.m_ColorSizeParticleArchetype = m_ColorSizeParticleArchetype;
            spawnJob.m_ColorParticleArchetype     = m_ColorParticleArchetype;
            spawnJob.m_SizeParticleArchetype      = m_SizeParticleArchetype;
            spawnJob.m_ParticleArchetype          = m_ParticleArchetype;
            inputDep = spawnJob.Schedule(this, inputDep);

            barrier.AddJobHandleForProducer(inputDep);
            return(inputDep);
        }
Пример #3
0
        protected override void OnUpdate()
        {
            var commandBuffer = _entityCommandBufferSystem.CreateCommandBuffer();
            // var commandBuffer = _entityCommandBufferSystem.CreateCommandBuffer().ToConcurrent();

            var mapEntity     = _mapQuery.GetSingletonEntity();
            var mapData       = _mapQuery.GetSingleton <MapData>();
            var mapTileBuffer = EntityManager.GetBuffer <MapTileBuffer>(mapEntity);

            var visualMapEntity = _visualMapQuery.GetSingletonEntity();
            var renderMesh      = EntityManager.GetSharedComponentData <RenderMesh>(visualMapEntity);

            Entities
            .WithAll <GenerateVisualMap>()
            // .ForEach((Entity entity) =>
            .ForEach((Entity entity, int entityInQueryIndex) =>
            {
                var w = mapData.Width;
                var h = mapData.Height;
                Debug.Log($"Making grid mesh - w: {w} h: {h}");
                var mesh = MeshUtility.GenerateGrid(w, h);

                renderMesh.mesh = mesh;
                commandBuffer.SetSharedComponent(visualMapEntity, renderMesh);
                // commandBuffer.SetSharedComponent(entityInQueryIndex, visualMapEntity, renderMesh);

                commandBuffer.DestroyEntity(entity);
                // commandBuffer.DestroyEntity(entityInQueryIndex, entity);
            })
            .WithoutBurst()
            .Run();
            // .Schedule();

            _entityCommandBufferSystem.AddJobHandleForProducer(Dependency);
        }
        protected override JobHandle OnUpdate(JobHandle inputDep)
        {
            var job = new ParticleAgeJob();

            job.commandBuffer = barrier.CreateCommandBuffer().ToConcurrent();
            job.deltaTime     = Time.deltaTime;
            var handle = job.Schedule(this, inputDep);

            barrier.AddJobHandleForProducer(handle);
            return(handle);
        }
Пример #5
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        NativeArray <DeleteEntityEvent> eventArray = m_Query.ToComponentDataArray <DeleteEntityEvent>(Allocator.TempJob);

        ParallellDeleteQueue parallellDeleteQueue = new ParallellDeleteQueue
        {
            lookup        = GetBufferFromEntity <Child>(true),
            eventArray    = eventArray,
            commandBuffer = beginPresentationEntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent()
        };

        inputDeps = parallellDeleteQueue.Schedule(eventArray.Length, 32, inputDeps);
        beginPresentationEntityCommandBufferSystem.AddJobHandleForProducer(inputDeps);

        return(inputDeps);
    }
Пример #6
0
        protected override JobHandle OnUpdate(JobHandle inputDep)
        {
            var commandBuffer = barrier.CreateCommandBuffer().ToConcurrent();
            var initJob       = new ParticleInitializeJob();

            initJob.emitterComponentType = ComponentType.ReadWrite <ParticleEmitterComponentData>();
            initJob.commandBuffer        = commandBuffer;
            initJob.randomData           = randomData;
            initJob.randomBase           = randomDataBase;
            var spawnCount = GetSingleton <ParticleSpawnCountComponent>().spawnCount;

            randomDataBase = (randomDataBase + spawnCount) % randomData.Length;

            inputDep = initJob.Schedule(this, inputDep);
            barrier.AddJobHandleForProducer(inputDep);
            return(inputDep);
        }