示例#1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var lifeJob = new LifeTimeJob
            {
                deltaTime = Time.DeltaTime
            }.Schedule(this, inputDeps);

            return(lifeJob);
        }
示例#2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new LifeTimeJob
            {
                DeltaTime     = Time.deltaTime,
                LifeTime      = _group.LifeTime,
                Entity        = _group.Entity,
                CommandBuffer = _lifeTimeSystemBarrier.CreateCommandBuffer()
            };

            return(job.Schedule(inputDeps));
        }
示例#3
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        LifeTimeJob lifeTimeJob = new LifeTimeJob {
            entityCommandBuffer = endSimulationEntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(),
            deltaTime           = Time.deltaTime
        };

        JobHandle jobHandle = lifeTimeJob.Schedule(this, inputDeps);

        endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(jobHandle);
        return(jobHandle);
    }
示例#4
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            EntityCommandBuffer.Concurrent commandBuffer = barrier.CreateCommandBuffer().ToConcurrent();

            var lifeTimeJobHandle = new LifeTimeJob {
                commandBuffer = commandBuffer,
                dt            = Time.deltaTime
            }.Schedule(this, inputDeps);

            barrier.AddJobHandleForProducer(lifeTimeJobHandle);

            return(lifeTimeJobHandle);
        }
示例#5
0
    // OnUpdate runs on the main thread.
    protected override JobHandle OnUpdate(JobHandle inputDependencies)
    {
        var commandBuffer = m_Barrier.CreateCommandBuffer().ToConcurrent();

        var job = new LifeTimeJob
        {
            DeltaTime     = Time.deltaTime,
            CommandBuffer = commandBuffer,
        }.Schedule(this, inputDependencies);

        m_Barrier.AddJobHandleForProducer(job);

        return(job);
    }
    protected override JobHandle OnUpdate(JobHandle inputDependencies)
    {
        var     commandBuffer = m_Barrier.CreateCommandBuffer().ToConcurrent();
        Vector3 tempPos       = Settings.PlayerPosition;

        var job = new LifeTimeJob
        {
            PlayerPosition = tempPos,
            CommandBuffer  = commandBuffer,
        }.Schedule(this, inputDependencies);

        m_Barrier.AddJobHandleForProducer(job);

        return(job);
    }
示例#7
0
    // OnUpdate runs on the main thread.
    protected override JobHandle OnUpdate(JobHandle inputDependencies)
    {
        var handle = new LifeTimeJob
        {
            DeltaTime = Time.deltaTime,
            Queue     = m_Queue.AsParallelWriter()
        }.Schedule(this, inputDependencies);

        handle = new LifeTimeCleanJob()
        {
            Queue         = m_Queue,
            CommandBuffer = m_Barrier.CreateCommandBuffer()
        }.Schedule(handle);

        m_Barrier.AddJobHandleForProducer(handle);

        return(handle);
    }
示例#8
0
        // OnUpdate runs on the main thread.
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            var commandBuffer = barrier.CreateCommandBuffer().ToConcurrent();

            var job = new LifeTimeJob()
            {
                DeltaTime     = Time.deltaTime,
                CommandBuffer = commandBuffer,
                Queue         = queue.ToConcurrent(),
            }.Schedule(this, inputDependencies);

            barrier.AddJobHandleForProducer(job);

            // Can't read and write into queue at the same time.
            job.Complete();

            float3 translation;

            if (queue.TryDequeue(out translation))
            {
                var em = World.Active.EntityManager;

                Entity instance = em.Instantiate(prefab);
                em.SetComponentData(instance, new Translation {
                    Value = translation
                });
                em.SetComponentData(instance, new LifeTime {
                    Value = random.NextFloat(10.0f, 500.0f)
                });
                em.SetComponentData(instance, new RotationSpeed {
                    RadiansPerSecond = math.radians(random.NextFloat(-35.0F, -15.0F))
                });
            }

            return(job);
        }