public void BeginSerialize(ComponentSystemBase system) { componentTypePlayerComponent = ComponentType.ReadWrite <PlayerComponent>(); componentTypePhysicsCollider = ComponentType.ReadWrite <PhysicsCollider>(); componentTypePhysicsGravityFactor = ComponentType.ReadWrite <PhysicsGravityFactor>(); componentTypePhysicsMass = ComponentType.ReadWrite <PhysicsMass>(); componentTypePhysicsVelocity = ComponentType.ReadWrite <PhysicsVelocity>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostPlayerComponentType = system.GetArchetypeChunkComponentType <PlayerComponent>(true); ghostRotationType = system.GetArchetypeChunkComponentType <Rotation>(true); ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild1RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild1TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild2RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild2TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild3RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild3TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild4RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild4TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild5RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild5TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild6RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild6TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild7RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild7TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild8RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild8TranslationType = system.GetComponentDataFromEntity <Translation>(true); }
public void BeginSerialize(ComponentSystemBase system) { componentTypePilotData = ComponentType.ReadWrite <PilotData>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostPilotDataType = system.GetArchetypeChunkComponentType <PilotData>(true); ghostRotationType = system.GetArchetypeChunkComponentType <Rotation>(true); ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild1RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild1TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild2RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild2TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild3RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild3TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild4RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild4TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild5RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild5TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild6RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild6TranslationType = system.GetComponentDataFromEntity <Translation>(true); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeHealth = ComponentType.ReadWrite <Health>(); componentTypePlayerUnit = ComponentType.ReadWrite <PlayerUnit>(); componentTypeUnitSelectionState = ComponentType.ReadWrite <UnitSelectionState>(); componentTypePhysicsCollider = ComponentType.ReadWrite <PhysicsCollider>(); componentTypeCompositeScale = ComponentType.ReadWrite <CompositeScale>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostHealthType = system.GetArchetypeChunkComponentType <Health>(true); ghostPlayerUnitType = system.GetArchetypeChunkComponentType <PlayerUnit>(true); ghostUnitSelectionStateType = system.GetArchetypeChunkComponentType <UnitSelectionState>(true); ghostRotationType = system.GetArchetypeChunkComponentType <Rotation>(true); ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild1RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild1TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild2RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild2TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild3RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild3TranslationType = system.GetComponentDataFromEntity <Translation>(true); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeAbilityCollectionAbilityEntry = ComponentType.ReadWrite <AbilityCollection.AbilityEntry>(); componentTypeAbilityCollectionState = ComponentType.ReadWrite <AbilityCollection.State>(); componentTypeAbilityOwnerOwnedAbility = ComponentType.ReadWrite <AbilityOwner.OwnedAbility>(); componentTypeAbilityOwnerOwnedCollection = ComponentType.ReadWrite <AbilityOwner.OwnedCollection>(); componentTypeAbilityOwnerState = ComponentType.ReadWrite <AbilityOwner.State>(); componentTypeAimDataData = ComponentType.ReadWrite <AimData.Data>(); componentTypeAnimSourceControllerRigData = ComponentType.ReadWrite <AnimSourceController.RigData>(); componentTypeAnimSourceControllerSettings = ComponentType.ReadWrite <AnimSourceController.Settings>(); componentTypeCharacterInterpolatedData = ComponentType.ReadWrite <Character.InterpolatedData>(); componentTypeCharacterPredictedData = ComponentType.ReadWrite <Character.PredictedData>(); componentTypeCharacterReplicatedData = ComponentType.ReadWrite <Character.ReplicatedData>(); componentTypeCharacterSettings = ComponentType.ReadWrite <Character.Settings>(); componentTypeCharacterControllerComponentData = ComponentType.ReadWrite <CharacterControllerComponentData>(); componentTypeCharacterControllerGroundSupportData = ComponentType.ReadWrite <CharacterControllerGroundSupportData>(); componentTypeCharacterControllerInitializationData = ComponentType.ReadWrite <CharacterControllerInitializationData>(); componentTypeCharacterControllerMoveQuery = ComponentType.ReadWrite <CharacterControllerMoveQuery>(); componentTypeCharacterControllerMoveResult = ComponentType.ReadWrite <CharacterControllerMoveResult>(); componentTypeCharacterControllerVelocity = ComponentType.ReadWrite <CharacterControllerVelocity>(); componentTypeDamageEvent = ComponentType.ReadWrite <DamageEvent>(); componentTypeDamageHistoryData = ComponentType.ReadWrite <DamageHistoryData>(); componentTypeHealthStateData = ComponentType.ReadWrite <HealthStateData>(); componentTypeInventoryInternalState = ComponentType.ReadWrite <Inventory.InternalState>(); componentTypeInventoryItemEntry = ComponentType.ReadWrite <Inventory.ItemEntry>(); componentTypeInventoryState = ComponentType.ReadWrite <Inventory.State>(); componentTypePartOwnerInputState = ComponentType.ReadWrite <PartOwner.InputState>(); componentTypePartOwnerRegistryAsset = ComponentType.ReadWrite <PartOwner.RegistryAsset>(); componentTypePlayerOwnerPlayerId = ComponentType.ReadWrite <Player.OwnerPlayerId>(); componentTypePlayerControlledState = ComponentType.ReadWrite <PlayerControlled.State>(); componentTypeSkeletonRenderer = ComponentType.ReadWrite <SkeletonRenderer>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostCharacterInterpolatedDataType = system.GetArchetypeChunkComponentType <Character.InterpolatedData>(true); ghostCharacterPredictedDataType = system.GetArchetypeChunkComponentType <Character.PredictedData>(true); ghostCharacterReplicatedDataType = system.GetArchetypeChunkComponentType <Character.ReplicatedData>(true); ghostCharacterControllerGroundSupportDataType = system.GetArchetypeChunkComponentType <CharacterControllerGroundSupportData>(true); ghostCharacterControllerMoveResultType = system.GetArchetypeChunkComponentType <CharacterControllerMoveResult>(true); ghostCharacterControllerVelocityType = system.GetArchetypeChunkComponentType <CharacterControllerVelocity>(true); ghostHealthStateDataType = system.GetArchetypeChunkComponentType <HealthStateData>(true); ghostInventoryStateType = system.GetArchetypeChunkComponentType <Inventory.State>(true); ghostPlayerOwnerPlayerIdType = system.GetArchetypeChunkComponentType <Player.OwnerPlayerId>(true); ghostPlayerControlledStateType = system.GetArchetypeChunkComponentType <PlayerControlled.State>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0AbilityAbilityControlType = system.GetComponentDataFromEntity <Ability.AbilityControl>(true); ghostChild0AbilityMovementInterpolatedStateType = system.GetComponentDataFromEntity <AbilityMovement.InterpolatedState>(true); ghostChild0AbilityMovementPredictedStateType = system.GetComponentDataFromEntity <AbilityMovement.PredictedState>(true); ghostChild1AbilityAbilityControlType = system.GetComponentDataFromEntity <Ability.AbilityControl>(true); ghostChild2AbilityAbilityControlType = system.GetComponentDataFromEntity <Ability.AbilityControl>(true); ghostChild2AbilityDashPredictedStateType = system.GetComponentDataFromEntity <AbilityDash.PredictedState>(true); ghostChild3AbilityAbilityControlType = system.GetComponentDataFromEntity <Ability.AbilityControl>(true); ghostChild3AbilityClimbPredictedStateType = system.GetComponentDataFromEntity <AbilityClimb.PredictedState>(true); }
void ScheduleMoreJobs() { NativeArray <ArchetypeChunk> dataChunks = meshDataGroup.CreateArchetypeChunkArray(Allocator.TempJob); EntityCommandBuffer eCBuffer = new EntityCommandBuffer(Allocator.TempJob); JobHandle allHandles = new JobHandle(); JobHandle previousHandle = new JobHandle(); ArchetypeChunkEntityType entityType = GetArchetypeChunkEntityType(); ArchetypeChunkComponentType <Sector> sectorType = GetArchetypeChunkComponentType <Sector>(true); ArchetypeChunkComponentType <SectorVisFacesCount> faceCountsType = GetArchetypeChunkComponentType <SectorVisFacesCount>(true); ArchetypeChunkBufferType <Block> blocksType = GetArchetypeChunkBufferType <Block>(true); ArchetypeChunkBufferType <BlockFaces> facesType = GetArchetypeChunkBufferType <BlockFaces>(true); for (int c = 0; c < dataChunks.Length; c++) { ArchetypeChunk dataChunk = dataChunks[c]; // Get chunk data NativeArray <Entity> entities = dataChunk.GetNativeArray(entityType); NativeArray <Sector> sectors = dataChunk.GetNativeArray(sectorType); NativeArray <SectorVisFacesCount> faceCounts = dataChunk.GetNativeArray(faceCountsType); BufferAccessor <Block> blockAccessor = dataChunk.GetBufferAccessor(blocksType); BufferAccessor <BlockFaces> facesAccessor = dataChunk.GetBufferAccessor(facesType); for (int e = 0; e < entities.Length; e++) { MeshDataJob meshDataJob = new MeshDataJob() { ECBuffer = eCBuffer, entity = entities[e], counts = faceCounts[e], sector = sectors[e], blocks = new NativeArray <Block>(blockAccessor[e].AsNativeArray(), Allocator.TempJob), blockFaces = new NativeArray <BlockFaces>(facesAccessor[e].AsNativeArray(), Allocator.TempJob), }; JobHandle thisHandle = meshDataJob.Schedule(previousHandle); allHandles = JobHandle.CombineDependencies(thisHandle, allHandles); previousHandle = thisHandle; } } runningCommandBuffer = eCBuffer; runningJobHandle = allHandles; dataChunks.Dispose(); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { //Timer specific var startTimerJob = new StartTimerJob(); var handle = startTimerJob.Schedule(inputDeps); //Timer specific if (_waypointGraph == null) { _waypointGraph = WaypointGraph.Instance; } EntityQuery query = GetEntityQuery(ComponentType.ReadOnly(typeof(PathFindingRequest))); if (query.CalculateEntityCount() == 0) { //Timer specific var endTimerJob2 = new EndTimerJob(); timerRecoder.RegisterTimeInMS(time); //Timer specific return(endTimerJob2.Schedule(handle)); } ArchetypeChunkBufferType <PathPositions> pathPositionBufferChunk = GetArchetypeChunkBufferType <PathPositions>(); ArchetypeChunkComponentType <PathFindingRequest> pathFindingRequestChunk = GetArchetypeChunkComponentType <PathFindingRequest>(true); ArchetypeChunkComponentType <PathIndex> pathIndexChunk = GetArchetypeChunkComponentType <PathIndex>(); //Update quadrants data FindPathJob2 findPathJob = new FindPathJob2() { waypoints = _waypointGraph.Waypoints, Neighbors = _waypointGraph.Neighbors, pathFindingRequestType = pathFindingRequestChunk, pathPositionType = pathPositionBufferChunk, pathIndexType = pathIndexChunk }; var handle2 = findPathJob.Schedule(query, handle); //Timer specific var endTimerJob = new EndTimerJob(); timerRecoder.RegisterTimeInMS(time); //Timer specific return(endTimerJob.Schedule(handle2)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { NativeArray <ArchetypeChunk> dataChunks = meshDataGroup.CreateArchetypeChunkArray(Allocator.TempJob); if (dataChunks.Length == 0) { dataChunks.Dispose(); return(inputDeps); } EntityCommandBuffer eCBuffer = new EntityCommandBuffer(Allocator.TempJob); ArchetypeChunkEntityType entityType = GetArchetypeChunkEntityType(); ArchetypeChunkComponentType <Sector> sectorType = GetArchetypeChunkComponentType <Sector>(true); ArchetypeChunkComponentType <SectorVisFacesCount> faceCountsType = GetArchetypeChunkComponentType <SectorVisFacesCount>(true); ArchetypeChunkBufferType <Block> blocksType = GetArchetypeChunkBufferType <Block>(true); ArchetypeChunkBufferType <BlockFaces> facesType = GetArchetypeChunkBufferType <BlockFaces>(true); for (int c = 0; c < dataChunks.Length; c++) { ArchetypeChunk dataChunk = dataChunks[c]; // Get chunk data NativeArray <Entity> entities = dataChunk.GetNativeArray(entityType); NativeArray <Sector> sectors = dataChunk.GetNativeArray(sectorType); NativeArray <SectorVisFacesCount> faceCounts = dataChunk.GetNativeArray(faceCountsType); BufferAccessor <Block> blockAccessor = dataChunk.GetBufferAccessor(blocksType); BufferAccessor <BlockFaces> facesAccessor = dataChunk.GetBufferAccessor(facesType); for (int e = 0; e < entities.Length; e++) { var meshDataJob = new MeshDataJob() { ECBuffer = eCBuffer, entity = entities[e], counts = faceCounts[e], sector = sectors[e], blocks = new NativeArray <Block>(blockAccessor[e].AsNativeArray(), Allocator.TempJob), blockFaces = new NativeArray <BlockFaces>(facesAccessor[e].AsNativeArray(), Allocator.TempJob), }.Schedule(inputDeps); meshDataJob.Complete(); } } eCBuffer.Playback(entityManager); eCBuffer.Dispose(); dataChunks.Dispose(); return(inputDeps); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeMovableCubeComponent = ComponentType.ReadWrite <MovableCubeComponent>(); componentTypePhysicsCollider = ComponentType.ReadWrite <PhysicsCollider>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostMovableCubeComponentType = system.GetArchetypeChunkComponentType <MovableCubeComponent>(true); ghostRotationType = system.GetArchetypeChunkComponentType <Rotation>(true); ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0RotationType = system.GetComponentDataFromEntity <Rotation>(true); ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeTeleporterClientDataClass = ComponentType.ReadWrite <TeleporterClientDataClass>(); componentTypeTeleporterPresentationData = ComponentType.ReadWrite <TeleporterPresentationData>(); componentTypeTeleporterServer = ComponentType.ReadWrite <TeleporterServer>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostTeleporterPresentationDataType = system.GetArchetypeChunkComponentType <TeleporterPresentationData>(true); ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true); ghostChild1TranslationType = system.GetComponentDataFromEntity <Translation>(true); }
protected override void OnUpdate() { EntityCommandBuffer eCBuffer = new EntityCommandBuffer(Allocator.Temp); NativeArray <ArchetypeChunk> dataChunks = applyMeshGroup.CreateArchetypeChunkArray(Allocator.TempJob); ArchetypeChunkEntityType entityType = GetArchetypeChunkEntityType(); ArchetypeChunkBufferType <MeshVert> vertType = GetArchetypeChunkBufferType <MeshVert>(true); ArchetypeChunkBufferType <MeshTri> triType = GetArchetypeChunkBufferType <MeshTri>(true); ArchetypeChunkBufferType <MeshUv> uvType = GetArchetypeChunkBufferType <MeshUv>(true); for (int c = 0; c < dataChunks.Length; c++) { ArchetypeChunk dataChunk = dataChunks[c]; NativeArray <Entity> entities = dataChunk.GetNativeArray(entityType); BufferAccessor <MeshVert> vertBuffers = dataChunk.GetBufferAccessor(vertType); BufferAccessor <MeshTri> triBuffers = dataChunk.GetBufferAccessor(triType); BufferAccessor <MeshUv> uvBuffers = dataChunk.GetBufferAccessor(uvType); for (int e = 0; e < entities.Length; e++) { Entity entity = entities[e]; bool redraw = entityManager.HasComponent <MeshRedraw>(entity); Mesh mesh = MakeMesh(vertBuffers[e], triBuffers[e], uvBuffers[e]); SetMeshComponent(redraw, mesh, entity, eCBuffer); if (redraw) { eCBuffer.RemoveComponent(entity, typeof(MeshRedraw)); } eCBuffer.RemoveComponent(entity, typeof(MeshVert)); eCBuffer.RemoveComponent(entity, typeof(MeshTri)); eCBuffer.RemoveComponent(entity, typeof(MeshUv)); } } eCBuffer.Playback(entityManager); eCBuffer.Dispose(); dataChunks.Dispose(); }
public void BeginSerialize(ComponentSystemBase system) { componentTypeAbilityCollectionAbilityEntry = ComponentType.ReadWrite <AbilityCollection.AbilityEntry>(); componentTypeAbilityCollectionState = ComponentType.ReadWrite <AbilityCollection.State>(); componentTypeItemInputState = ComponentType.ReadWrite <Item.InputState>(); componentTypePartOwnerInputState = ComponentType.ReadWrite <PartOwner.InputState>(); componentTypePartOwnerRegistryAsset = ComponentType.ReadWrite <PartOwner.RegistryAsset>(); componentTypeRigAttacherAttachBone = ComponentType.ReadWrite <RigAttacher.AttachBone>(); componentTypeRigAttacherState = ComponentType.ReadWrite <RigAttacher.State>(); componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>(); componentTypeRotation = ComponentType.ReadWrite <Rotation>(); componentTypeTranslation = ComponentType.ReadWrite <Translation>(); componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>(); ghostItemInputStateType = system.GetArchetypeChunkComponentType <Item.InputState>(true); ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true); ghostChild0AbilityAbilityActionType = system.GetComponentDataFromEntity <Ability.AbilityAction>(true); ghostChild0AbilityAbilityControlType = system.GetComponentDataFromEntity <Ability.AbilityControl>(true); ghostChild0AbilityAutoRifleInterpolatedStateType = system.GetComponentDataFromEntity <AbilityAutoRifle.InterpolatedState>(true); ghostChild0AbilityAutoRiflePredictedStateType = system.GetComponentDataFromEntity <AbilityAutoRifle.PredictedState>(true); }
public void ScheduleTimeInitialize(ComponentSystemBase jobComponentSystem, bool isReadOnly) { _type = jobComponentSystem.GetArchetypeChunkBufferType <T>(isReadOnly); }