예제 #1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MoveToPositionJob
            {
                deltaSecond = Time.DeltaTime,
                ECBuffer    = _ecbSystem.CreateCommandBuffer().ToConcurrent()
            };
            var handle = job.Schedule(this, inputDeps);

            _ecbSystem.AddJobHandleForProducer(handle);
            return(handle);
        }
예제 #2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        JobHandle forwardJob = new MoveForwardJob
        {
            DeltaTime = Time.DeltaTime
        }.Schedule(this, inputDeps);

        JobHandle toPosition = new MoveToPositionJob
        {
            DeltaTime = Time.DeltaTime
        }.Schedule(this, forwardJob);


        return(toPosition);
    }
    private void Update()
    {
        MoveToPositionJob transformJob = new MoveToPositionJob()
        {
            newX = Random.Range(1, 4),
            newY = Random.Range(1, 4),
            dt   = Time.deltaTime
        };

        transformJobHandle = transformJob.Schedule(transformAccessArray);
        JobHandle.ScheduleBatchedJobs();
        transformJobHandle.Complete();
        if (transformJobHandle.IsCompleted)
        {
            Debug.Log("Transform Job Completed!");
        }
    }