protected override JobHandle OnUpdate(JobHandle inputDeps)
            {
                var job = new SteeringJob()
                {
                    Positions      = group.GetComponentDataArray <Position>(),
                    Movements      = group.GetComponentDataArray <MovementData>(),
                    SharedSteering = group.GetSharedComponentDataArray <SteeringSharedData>()[0],
                    Steerings      = group.GetComponentDataArray <SteeringData>()
                };

                return(job.Schedule(group.GetComponentDataArray <SteeringData>().Length, 16, inputDeps));
            }
示例#2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var physicsWorldSystem = World.Active.GetExistingSystem <BuildPhysicsWorld>();

        var job = new SteeringJob {
            Routes = GetBufferFromEntity <BufferedNavNode>(),
            EntityCommandBuffer = _entityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(),
            World = physicsWorldSystem.PhysicsWorld
        };

        var jobHandle = job.Schedule(this, inputDeps);

        _entityCommandBufferSystem.AddJobHandleForProducer(jobHandle);

        return(jobHandle);
    }
示例#3
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var settings = GetSingleton <ServerSettings>();
            var steerJob = new SteeringJob
            {
                commandBuffer   = barrier.CreateCommandBuffer().ToConcurrent(),
                deltaTime       = Time.deltaTime,
                displacement    = 100.0f,
                playerForce     = settings.playerForce,
                bulletArchetype = settings.bulletArchetype,
                bulletVelocity  = settings.bulletVelocity,
                bulletRadius    = settings.bulletRadius,
                currentTick     = serverSimulationSystemGroup.ServerTick
            };
            var handle = steerJob.Schedule(this, inputDeps);

            barrier.AddJobHandleForProducer(handle);
            return(handle);
        }
示例#4
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            if (bulletPrefab == Entity.Null && bulletSpawnArchetype == default)
            {
                if (World.GetExistingSystem <ServerSimulationSystemGroup>() != null)
                {
                    var prefabs       = GetSingleton <GhostPrefabCollectionComponent>();
                    var serverPrefabs = EntityManager.GetBuffer <GhostPrefabBuffer>(prefabs.serverPrefabs);
                    for (int i = 0; i < serverPrefabs.Length; ++i)
                    {
                        if (EntityManager.HasComponent <BulletTagComponent>(serverPrefabs[i].Value))
                        {
                            bulletPrefab = serverPrefabs[i].Value;
                        }
                    }
                }
                else
                {
                    bulletSpawnArchetype = EntityManager.CreateArchetype(
                        ComponentType.ReadWrite <PredictedGhostSpawnRequestComponent>(),
                        ComponentType.ReadWrite <BulletSnapshotData>());
                }
            }
            var level    = GetSingleton <LevelComponent>();
            var steerJob = new SteeringJob
            {
                commandBuffer        = barrier.CreateCommandBuffer().ToConcurrent(),
                deltaTime            = Time.DeltaTime,
                displacement         = 100.0f,
                playerForce          = level.playerForce,
                bulletVelocity       = level.bulletVelocity,
                bulletPrefab         = bulletPrefab,
                bulletSpawnArchetype = bulletSpawnArchetype,
                currentTick          = predictionGroup.PredictingTick,
                inputFromEntity      = GetBufferFromEntity <ShipCommandData>(true)
            };
            var handle = steerJob.Schedule(this, inputDeps);

            barrier.AddJobHandleForProducer(handle);
            return(handle);
        }
示例#5
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var topGroup = World.GetExistingSystem <ClientSimulationSystemGroup>();
        var settings = GetSingleton <ClientSettings>();
        var steerJob = new SteeringJob
        {
            deltaTime            = topGroup.UpdateDeltaTime,
            displacement         = 100.0f,
            playerForce          = settings.playerForce,
            currentTick          = NetworkTimeSystem.predictTargetTick,
            lastPredictedSpawn   = lastPredictedSpawn,
            bulletSpawnArchetype = bulletSpawnArchetype,
            commandBuffer        = barrier.CreateCommandBuffer().ToConcurrent(),
            snapshotFromEntity   = GetBufferFromEntity <ShipSnapshotData>(true),
            inputFromEntity      = GetBufferFromEntity <ShipCommandData>(true)
        };
        var handle = steerJob.ScheduleSingle(this, inputDeps);

        barrier.AddJobHandleForProducer(handle);
        return(handle);
    }