private void UpdateAll() { int runningDynamicBoneCount = headInfoList.Length; if (runningDynamicBoneCount == 0) { return; } int dataArrayLength = runningDynamicBoneCount * MaxParticleLimit; JobHandle colliderSetup = new ColliderSetupJob() { ColliderArray = colliderInfoList }.Schedule(colliderTransformAccessArray); JobHandle boneSetup = new BoneSetupJob { HeadArray = headInfoList, }.Schedule(headTransformAccessArray); JobHandle dependency = JobHandle.CombineDependencies(colliderSetup, boneSetup); dependency = new UpdateParticles1Job { HeadArray = headInfoList, ParticleArray = particleInfoList, }.Schedule(dataArrayLength, MaxParticleLimit, dependency); dependency = new UpdateParticle2Job { HeadArray = headInfoList, ParticleArray = particleInfoList, ColliderArray = colliderInfoList, BoneColliderMatchMap = boneColliderMatchMap }.Schedule(dataArrayLength, MaxParticleLimit, dependency); dependency = new ApplyToTransformJob { ParticleArray = particleInfoList, }.Schedule(particleTransformAccessArray, dependency); dependency.Complete(); }
private void LateUpdate() { if (!m_lastJobHandle.IsCompleted) { return; } m_lastJobHandle.Complete(); UpdateQueue(); if (m_DbDataLen == 0) { return; } var dataArrLength = m_DbDataLen * DynamicBoneBeta.MAX_TRANSFORM_LIMIT; var rootJob = new RootPosApplyJob { ParticleHeadInfo = this.m_headInfo }; var rootHandle = rootJob.Schedule(m_headRootTransform); var prepareJob = new PrepareParticleJob { ParticleHeadInfo = this.m_headInfo, ParticleInfo = this.m_particleInfo, HeadCount = m_DbDataLen }; var prepareHandle = prepareJob.Schedule(rootHandle); var update1Job = new UpdateParticles1Job { ParticleHeadInfo = this.m_headInfo, ParticleInfo = this.m_particleInfo, HeadCount = m_DbDataLen }; var update1Handle = update1Job.Schedule(dataArrLength, DynamicBoneBeta.MAX_TRANSFORM_LIMIT, prepareHandle); var update2Job = new UpdateParticle2Job { ParticleHeadInfo = this.m_headInfo, ParticleInfo = this.m_particleInfo, HeadCount = m_DbDataLen }; var update2Handle = update2Job.Schedule(dataArrLength, DynamicBoneBeta.MAX_TRANSFORM_LIMIT, update1Handle); var appTransJob = new ApplyParticleToTransform { ParticleHeadInfo = this.m_headInfo, ParticleInfo = this.m_particleInfo, HeadCount = m_DbDataLen }; var appTransHandle = appTransJob.Schedule(dataArrLength, DynamicBoneBeta.MAX_TRANSFORM_LIMIT, update2Handle); var finalJob = new FinalJob { ParticleInfo = this.m_particleInfo, }; var finalHandle = finalJob.Schedule(this.m_particleTransformArr, appTransHandle); m_lastJobHandle = finalHandle; JobHandle.ScheduleBatchedJobs(); }