protected override JobHandle OnUpdate(JobHandle inputDeps) { var inputDeps1 = new AddSystemStateJob { Ecb = m_EntityCommandBuffer.CreateCommandBuffer().ToConcurrent(), EntityType = GetArchetypeChunkEntityType(), Targets = GetArchetypeChunkComponentType <AbilityOwnerComponent>() }.Schedule(m_AddSystemState, inputDeps); var inputDeps2 = new CleanupEntityJob { Ecb = m_EntityCommandBuffer.CreateCommandBuffer().ToConcurrent(), EntityType = GetArchetypeChunkEntityType(), }.Schedule(m_RemoveSystemState, inputDeps); inputDeps = JobHandle.CombineDependencies(inputDeps, inputDeps1, inputDeps2); inputDeps = new RemoveElementFromDynamicBuffer { bufferFromEntity = GetBufferFromEntity <GrantedAbilityBufferElement>(), entities = m_RemoveSystemState.ToEntityArray(Allocator.TempJob), targetComponents = m_RemoveSystemState.ToComponentDataArray <GrantedAbilitySystemStateComponent>(Allocator.TempJob) }.Schedule(inputDeps); inputDeps = new AddElementToDynamicBuffer { bufferFromEntity = GetBufferFromEntity <GrantedAbilityBufferElement>(), entities = m_AddSystemState.ToEntityArray(Allocator.TempJob), targetComponents = m_AddSystemState.ToComponentDataArray <AbilityOwnerComponent>(Allocator.TempJob) }.Schedule(inputDeps); m_EntityCommandBuffer.AddJobHandleForProducer(inputDeps); return(inputDeps); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { // Entity has just been created. Add the system state component var inputDeps1 = new AddSystemStateComponent { Ecb = m_EntityCommandBuffer.CreateCommandBuffer().ToConcurrent() }.Schedule(m_AddSystemState, inputDeps); var inputDeps2 = new RemoveSystemStateComponent { Ecb = m_EntityCommandBuffer.CreateCommandBuffer().ToConcurrent() }.Schedule(m_RemoveSystemState, inputDeps); inputDeps = JobHandle.CombineDependencies(inputDeps, inputDeps1, inputDeps2); inputDeps.Complete(); inputDeps = new RemoveElementFromDynamicBuffer { bufferFromEntity = GetBufferFromEntity <AttributeBufferElement <TModifierTag, TAttribute> >(), entities = m_RemoveSystemState.ToEntityArray(Allocator.TempJob), systemStateComponents = m_RemoveSystemState.ToComponentDataArray <AttributeModificationActivatedSystemStateComponent <TModifierTag, TAttribute> >(Allocator.TempJob) }.Schedule(inputDeps); inputDeps = new AddElementToDynamicBuffer { bufferFromEntity = GetBufferFromEntity <AttributeBufferElement <TModifierTag, TAttribute> >(), entities = m_AddSystemState.ToEntityArray(Allocator.TempJob), ownerComponents = m_AddSystemState.ToComponentDataArray <AttributesOwnerComponent>(Allocator.TempJob) }.Schedule(inputDeps); // Add attribute modification pointer to actor // Remove attribute modification pointer from actor m_EntityCommandBuffer.AddJobHandleForProducer(inputDeps); return(inputDeps); }