示例#1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var entityType        = GetArchetypeChunkEntityType();
            var damagehistoryType = GetArchetypeChunkBufferType <DamageHistory>();

            var historyJob = new HistoryJob
            {
                Time              = Time.time,
                DamageEvents      = m_DamageEventsQuery.ToComponentDataArray <DamageEvent>(Allocator.TempJob),
                EntityType        = entityType,
                DamageHistoryType = damagehistoryType
            };
            var historyHandle = historyJob.Schedule(m_HistoryQuery, inputDeps);

            var addDamageStackJob = new AddDamageStackJob
            {
                ECB = m_EndSim.CreateCommandBuffer().ToConcurrent(),
                DamageStackBuffer = GetBufferFromEntity <DamageStack>()
            };
            var addDamageStackHandle = addDamageStackJob.Schedule(this, historyHandle);

            m_EndSim.AddJobHandleForProducer(addDamageStackHandle);

            var processDamageStackJob    = new ProcessDamage();
            var processDamageStackHandle = processDamageStackJob.Schedule(this, addDamageStackHandle);

            var tagDeadJob = new TagDeadJob {
                EntityCommandBuffer = m_EndSim.CreateCommandBuffer().ToConcurrent()
            };
            var tagDeadHandle = tagDeadJob.Schedule(this, processDamageStackHandle);

            m_EndSim.AddJobHandleForProducer(tagDeadHandle);
            return(tagDeadHandle);
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new AddDamageStackJob
            {
                EntityCommandBuffer = m_EndSimSystem.CreateCommandBuffer().ToConcurrent()
            };
            var handle = job.Schedule(this, inputDeps);

            m_EndSimSystem.AddJobHandleForProducer(handle);

            return(handle);
        }