public static JobHandle GetChangedChunks <T>( this EntityQuery query, ComponentSystemBase system, Allocator allocator, ref NativeQueue <VTuple <int, int> > .ParallelWriter changedEntitySlices, JobHandle inputDeps, bool changeAll = false) where T : struct, IComponentData { var chunks = query.CreateArchetypeChunkArrayAsync(allocator, out var createChunksHandle); inputDeps = JobHandle.CombineDependencies(inputDeps, createChunksHandle); var indicesState = new NativeArray <int>(chunks.Length, Allocator.TempJob); inputDeps = new MemsetNativeArray <int> { Source = indicesState, Value = -1 }.Schedule(indicesState.Length, 64, inputDeps); inputDeps = new GatherChunkChanged <T> { ChunkType = system.GetComponentTypeHandle <T>(true), ChangedIndices = indicesState, LastSystemVersion = system.LastSystemVersion, ForceChange = changeAll }.Schedule(query, inputDeps); inputDeps = new ExtractChangedSlicesFromChunks { Source = indicesState, Chunks = chunks, Slices = changedEntitySlices }.Schedule(indicesState.Length, 64, inputDeps); inputDeps = indicesState.Dispose(inputDeps); return(inputDeps); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeActiveComponent = ComponentType.ReadWrite <ActiveComponent>(); componentTypeOwnerComponent = ComponentType.ReadWrite <OwnerComponent>(); componentTypeProjectileTag = ComponentType.ReadWrite <ProjectileTag>(); componentTypePhysicsCollider = ComponentType.ReadWrite <PhysicsCollider>(); componentTypePhysicsGravityFactor = ComponentType.ReadWrite <PhysicsGravityFactor>(); componentTypePhysicsMass = ComponentType.ReadWrite <PhysicsMass>(); componentTypePhysicsVelocity = ComponentType.ReadWrite <PhysicsVelocity>(); componentTypeCompositeScale = ComponentType.ReadWrite <CompositeScale>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); ghostActiveComponentType = system.GetComponentTypeHandle <ActiveComponent>(true); ghostRotationType = system.GetComponentTypeHandle <Rotation>(true); ghostTranslationType = system.GetComponentTypeHandle <Translation>(true); }
public override JobHandle Update(ComponentSystemBase system, EntityQuery query, JobHandle inputDeps) { inputDeps = new ExtractValuesPerChunk { ChunkType = system.GetComponentTypeHandle <LocalToWorld>(true), Values = m_values, LastSystemVersion = system.LastSystemVersion, ExtractAll = m_changed }.Schedule(query, inputDeps); return(inputDeps); }
public static JobHandle CopyFromChangedComponentData <T>( this EntityQuery query, ComponentSystemBase system, ref NativeHashMap <Entity, T> resultChangedComponentData, JobHandle inputDeps) where T : struct, IComponentData { inputDeps = new CopyFromChangedComponentData <T> { EntityType = system.GetEntityTypeHandle(), ChunkType = system.GetComponentTypeHandle <T>(false), ChangedComponentData = resultChangedComponentData }.Schedule(query, inputDeps); return(inputDeps); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeBoostComponent = ComponentType.ReadWrite <BoostComponent>(); componentTypeCarComponent = ComponentType.ReadWrite <CarComponent>(); componentTypeCarTag = ComponentType.ReadWrite <CarTag>(); componentTypeHealthComponent = ComponentType.ReadWrite <HealthComponent>(); componentTypeMissileScopeComponent = ComponentType.ReadWrite <MissileScopeComponent>(); componentTypeProgressionComponent = ComponentType.ReadWrite <ProgressionComponent>(); componentTypeShieldComponent = ComponentType.ReadWrite <ShieldComponent>(); componentTypeSynchronizedCarComponent = ComponentType.ReadWrite <SynchronizedCarComponent>(); componentTypePhysicsCollider = ComponentType.ReadWrite <PhysicsCollider>(); componentTypePhysicsDamping = ComponentType.ReadWrite <PhysicsDamping>(); componentTypePhysicsMass = ComponentType.ReadWrite <PhysicsMass>(); componentTypePhysicsVelocity = ComponentType.ReadWrite <PhysicsVelocity>(); componentTypeCompositeScale = ComponentType.ReadWrite <CompositeScale>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); ghostHealthComponentType = system.GetComponentTypeHandle <HealthComponent>(true); ghostProgressionComponentType = system.GetComponentTypeHandle <ProgressionComponent>(true); ghostSynchronizedCarComponentType = system.GetComponentTypeHandle <SynchronizedCarComponent>(true); ghostRotationType = system.GetComponentTypeHandle <Rotation>(true); ghostTranslationType = system.GetComponentTypeHandle <Translation>(true); }
public static JobHandle DidChange <T>( this EntityQuery query, ComponentSystemBase system, ref NativeUnit <bool> changed, JobHandle inputDeps, bool changeAll = false) where T : struct, IComponentData { return(new DidChange <T> { ChunkType = system.GetComponentTypeHandle <T>(true), Changed = changed, LastSystemVersion = system.LastSystemVersion, ForceChange = changeAll }.ScheduleParallel(query, inputDeps)); }
public static JobHandle GetChangedComponentDataFromEntity <T>( this EntityQuery query, ComponentSystemBase system, ref NativeHashMap <Entity, T> resultHashMap, JobHandle inputDeps) where T : struct, IComponentData { inputDeps = resultHashMap.Clear(inputDeps, query.CalculateEntityCount()); inputDeps = new ChangedComponentToEntity <T> { EntityType = system.GetEntityTypeHandle(), ChunkType = system.GetComponentTypeHandle <T>(true), ChangedComponents = resultHashMap.AsParallelWriter(), LastSystemVersion = system.LastSystemVersion }.Schedule(query, inputDeps); return(inputDeps); }
public static LayerChunkTypeGroup BuildLayerChunkTypeGroup(ComponentSystemBase system) { LayerChunkTypeGroup result = new LayerChunkTypeGroup { collider = system.GetComponentTypeHandle <Collider>(true), translation = system.GetComponentTypeHandle <Translation>(true), rotation = system.GetComponentTypeHandle <Rotation>(true), scale = system.GetComponentTypeHandle <PhysicsScale>(true), parent = system.GetComponentTypeHandle <Parent>(true), localToWorld = system.GetComponentTypeHandle <LocalToWorld>(true), entity = system.GetEntityTypeHandle() }; return(result); }
public void BeginSerialize(ComponentSystemBase system, NativeArray <ArchetypeChunk> chunks) { AllChunks = chunks; GhostType = system.GetComponentTypeHandle <GhostIdentifier>(); EntityType = system.GetEntityTypeHandle(); }
public void ScheduleTimeInitialize(ComponentSystemBase jobComponentSystem, bool isReadOnly) { _typeHandle = jobComponentSystem.GetComponentTypeHandle <T>(isReadOnly); }