コード例 #1
0
ファイル: SleepProcessor.cs プロジェクト: eterlan/Mu-Yin
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var bedCount = m_bedGroup.CalculateEntityCount();
            var bedInfos = new NativeArray <BedInfo>(bedCount, Allocator.TempJob);
            var prepareBedInfoJobHandle = new PrepareBedData {
                BedInfos = bedInfos
            }
            .Schedule(m_bedGroup, inputDeps);

            var onStartNavigateJobHandle = new OnActionSelectedJob
            {
                BedInfos = bedInfos
            }.Schedule(this, prepareBedInfoJobHandle);

            var onArrivedJobHandle = new OnArrivedJob
            {
                EndEcb = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, onStartNavigateJobHandle);

            var inActionProcessingJobHandle = new InActionProcessingJob
            {
                BedInfos = bedInfos,
            }.Schedule(this, onArrivedJobHandle);

            var onActionEndJobHandle = new OnActionEndJob().Schedule(this, inActionProcessingJobHandle);

            inputDeps = onActionEndJobHandle;
            m_endEcbSystem.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
コード例 #2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var onActionSelectedJobHandle = new OnActSelectedJob
            {
                EntityType        = GetArchetypeChunkEntityType(),
                ActInfoType       = GetArchetypeChunkComponentType <ActionInfo>(true),
                NotRequireNavType = GetArchetypeChunkComponentType <NotRequireNavigation>(true),
                EndEcb            = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(m_onActSelectedGroup, inputDeps);

            var onArrivedJobHandle = new OnArrivedJob
            {
                EndEcb = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, onActionSelectedJobHandle);

            var onActionInvalidJobHandle = new OnActionInvalidJob
            {
                EndEcb = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, onArrivedJobHandle);

            var inActionProcessingJobHandle = new InActionProcessingJob
            {
                DeltaTime = Time.deltaTime,
                EndEcb    = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, onActionInvalidJobHandle);

            var onActionEndJobHandle = new OnActionEndJob
            {
                EndEcb = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, inActionProcessingJobHandle);

            var processValidateUsageResultJobHandle = new ProcessValidateUsageResultJob
            {
                BeginEcb = m_beginEcbSystem.CreateCommandBuffer().ToConcurrent(),
                EndEcb   = m_endEcbSystem.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, inputDeps);

            inputDeps = JobHandle.CombineDependencies(onActionEndJobHandle, processValidateUsageResultJobHandle);
            m_endEcbSystem.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }