protected override JobHandle OnUpdate(JobHandle inputDeps) { var entityType = GetArchetypeChunkEntityType(); JobHandle playerHandle; var playerEntity = playerGroup.ToEntityArray(Allocator.TempJob, out playerHandle); var updateJob = new UpdateJob { snapshotFromEntity = GetBufferFromEntity <ShipSnapshotData>(), targetTick = NetworkTimeSystem.interpolateTargetTick }; inputDeps = updateJob.Schedule(this, inputDeps); var destroyJob = new DestroyJob { commandBuffer = m_Barrier.CreateCommandBuffer().ToConcurrent(), entityType = entityType, playerEntity = playerEntity, playerStateFromEntity = GetComponentDataFromEntity <PlayerStateComponentData>() }; inputDeps = destroyJob.Schedule(destroyGroup, JobHandle.CombineDependencies(inputDeps, playerHandle)); m_Barrier.AddJobHandleForProducer(inputDeps); return(inputDeps); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var settings = GetSingleton <SettingsComponent>(); var cachedEntities = new NativeArray <Entity>(settings.Width * settings.Height, Allocator.TempJob); var helper = new ArrayHelper(settings.Width, settings.Height); var cacheJob = new CacheJob { CachedEntities = cachedEntities, Entities = _positionsQuery.ToEntityArray(Allocator.TempJob), Positions = _positionsQuery.ToComponentDataArray <PositionComponent>(Allocator.TempJob), Helper = helper }; var destroyJob = new DestroyJob { CachedEntities = cachedEntities, CommandBuffer = _commandBuffer.CreateCommandBuffer(), ClickedComponents = _clickedQuery.ToComponentDataArray <ClickedComponent>(Allocator.TempJob), InGroup = GetComponentDataFromEntity <InGroupComponent>(true), Helper = helper, MinGroupSize = settings.MinGroupSize }; var jobHandle = cacheJob.Schedule(_positionsQuery.CalculateEntityCount(), 32, inputDeps); jobHandle = destroyJob.Schedule(jobHandle); _commandBuffer.AddJobHandleForProducer(jobHandle); return(jobHandle); }
protected override void OnUpdate() { var entityType = GetEntityTypeHandle(); var playerEntity = GetSingletonEntity <NetworkIdComponent>(); var commandTargetFromEntity = GetComponentDataFromEntity <CommandTargetComponent>(); var commandBuffer = m_Barrier.CreateCommandBuffer().AsParallelWriter(); Entities.WithNone <GhostShipState>().WithAll <ShipTagComponentData, PredictedGhostComponent>().ForEach((Entity entity) => { var state = commandTargetFromEntity[playerEntity]; state.targetEntity = entity; commandTargetFromEntity[playerEntity] = state; commandBuffer.AddComponent(0, entity, new GhostShipState()); }).Schedule(); var destroyJob = new DestroyJob { commandBuffer = commandBuffer, entityType = entityType, playerEntity = playerEntity, commandTargetFromEntity = GetComponentDataFromEntity <CommandTargetComponent>() }; var inputDeps = destroyJob.Schedule(m_DestroyGroup, Dependency); m_Barrier.AddJobHandleForProducer(inputDeps); Dependency = inputDeps; }
protected override JobHandle OnUpdate(JobHandle inputDeps) { endSimulationBuffer = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>(); DestroyJob job = new DestroyJob(endSimulationBuffer.CreateCommandBuffer()); JobHandle jobHandle = job.Schedule(this, inputDeps); endSimulationBuffer.AddJobHandleForProducer(jobHandle); return(jobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { DestroyJob destroyJob = new DestroyJob { entityCommandBuffer = endSimulationEntityCommandBuffer.CreateCommandBuffer().ToConcurrent() }; JobHandle jobHandle = destroyJob.Schedule(this, inputDeps); endSimulationEntityCommandBuffer.AddJobHandleForProducer(jobHandle); return(jobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var job = new DestroyJob() { limit = GameDataManager.instance.AsteroidCount, CommandBuffer = endSimCommandBufferSystem.CreateCommandBuffer().ToConcurrent() }; var jobHandle = job.Schedule(this, inputDeps); endSimCommandBufferSystem.AddJobHandleForProducer(jobHandle); return(jobHandle); }
protected override JobHandle OnUpdate(JobHandle handle) { var commandBuffer = commandBufferSystem.CreateCommandBuffer(); var destroyJob = new DestroyJob { CommandBuffer = commandBuffer, }; handle = HandleMessage(handle, commandBuffer); handle = destroyJob.Schedule(this, handle); commandBufferSystem.AddJobHandleForProducer(handle); return(handle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { DestroyJob lifetimeJob = new DestroyJob { Entities = _destroyGroup.Entities, ToDestroy = _destroyGroup.ToDestroy, CommandBuffer = _jobBarrier.CreateCommandBuffer().ToConcurrent() }; var jobHandle = lifetimeJob.Schedule(_destroyGroup.Length, 500, inputDeps); jobHandle.Complete(); return(jobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { inputDeps = base.OnUpdate(inputDeps); var entityType = GetArchetypeChunkEntityType(); JobHandle playerHandle; var playerEntity = m_PlayerGroup.ToEntityArray(Allocator.TempJob, out playerHandle); var destroyJob = new DestroyJob { commandBuffer = m_Barrier.CreateCommandBuffer().ToConcurrent(), entityType = entityType, playerEntity = playerEntity, commandTargetFromEntity = GetComponentDataFromEntity <CommandTargetComponent>() }; inputDeps = destroyJob.Schedule(m_DestroyGroup, JobHandle.CombineDependencies(inputDeps, playerHandle)); m_Barrier.AddJobHandleForProducer(inputDeps); return(inputDeps); }