Esempio n. 1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            if (!Highway.USE_HYBRID_RENDERER)
            {
                Positions = m_PositionQuery.ToComponentDataArray <LocalToWorld>(Allocator.TempJob);
                Colors    = m_PositionQuery.ToComponentDataArray <ColorComponent>(Allocator.TempJob);
            }

            // Launch the update space partition jobs for next frame
            SpacePartition.Create(
                Highway.instance.DotsHighway.LaneLength(
                    (Highway.instance.DotsHighway.NumLanes - 1) * 0.5f),
                Game.instance.bucketDistance,
                Highway.instance.NumCars,
                Allocator.Persistent);

            var buildJob = new BuildSpacePartitionJob
            {
                SpacePartition = SpacePartition.AsParallelWriter(),
                DotsHighway    = Highway.instance.DotsHighway
            };
            var buildDeps = buildJob.Schedule(this, inputDeps);

            DotsHighway.RegisterReaderJob(buildDeps);

            var queryJob = new GetNearestCarsJob
            {
                SpacePartition = SpacePartition,
                CarSize        = Game.instance.distanceToBack + Game.instance.distanceToFront
            };

            return(queryJob.Schedule(this, buildDeps));
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new TryMergeSystemJob
            {
                DotsHighway = Highway.instance.DotsHighway,
            };
            var deps = job.Schedule(this, inputDeps);

            DotsHighway.RegisterReaderJob(deps);
            return(deps);
        }
Esempio n. 3
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MoveSystemJob
            {
                deltaTime   = Time.deltaTime,
                DotsHighway = Highway.instance.DotsHighway
            };
            var deps = job.Schedule(this, inputDeps);

            DotsHighway.RegisterReaderJob(deps);
            return(deps);
        }