예제 #1
0
        protected override void OnUpdate()
        {
            float deltaTime = Time.DeltaTime;

            // Job, move player along path

            MovementJob movementJob = new MovementJob()
            {
                deltaTime          = deltaTime,
                translationType    = GetArchetypeChunkComponentType <Translation>(false),
                rotationType       = GetArchetypeChunkComponentType <Rotation>(false),
                playerMovementType = GetArchetypeChunkComponentType <PlayerMovementData>(false),
                pathNodeBufferType = GetArchetypeChunkBufferType <PlayerNavigationNodeElement>(true),
            };
            JobHandle movementHandle = movementJob.ScheduleParallel(this.playerQuery, this.Dependency);

            this.Dependency = movementHandle;
        }
예제 #2
0
    protected override void OnUpdate()
    {
        // chunk vars
        var translationType = GetComponentTypeHandle <Translation>();
        var rotationType    = GetComponentTypeHandle <Rotation>(true);
        var movementType    = GetComponentTypeHandle <MovementComponent>();
        var entityInfoType  = GetComponentTypeHandle <EntityInfo>();
        var entities        = GetEntityTypeHandle();

        // job
        var job = new MovementJob();

        job.deltaTime             = Time.DeltaTime;
        job.addRemoveTags         = addRemoveTags.AsParallelWriter();
        job.MovementTypeHandle    = movementType;
        job.RotationTypeHandle    = rotationType;
        job.TranslationTypeHandle = translationType;
        job.EntityInfoTypeHandle  = entityInfoType;
        job.EntityType            = entities;

        int batchesPerChunk = 4;

        this.Dependency = job.ScheduleParallel(m_Group, batchesPerChunk, this.Dependency);
    }