protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var count       = _query.CalculateLength();
            var shellsQueue = new NativeArray <float3>(count, Allocator.TempJob);
            var reloadJob   = new ReloadJob
            {
                delta          = Time.deltaTime,
                shellPositions = shellsQueue
            };

            var shootJob = new ShootJob
            {
                shellPositions = shellsQueue,
                commandBuffer  = _commandBufferSystem.CreateCommandBuffer(),
                shellTemplate  = _shellTemplate
            };

            var handle = reloadJob.Schedule(_query);

            handle = shootJob.Schedule(handle);

            _commandBufferSystem.AddJobHandleForProducer(handle);

            return(handle);
        }
示例#2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            ShootJob job = new ShootJob
            {
                time = UnityEngine.Time.time,
            };
            JobHandle handle = job.Schedule(this, inputDeps);

            return(handle);
        }
示例#3
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new ShootJob
        {
            Inputs    = _players.Inputs,
            PlayerPos = _players.Positions,
            Accuracy  = Bootstrap.Accuracy
        };

        return(job.Schedule(this, 1, inputDeps));
    }
示例#4
0
        // OnUpdate runs on the main thread.
        protected override void OnUpdate()
        {
            ComponentTypeHandle <ShootDelayData> shootDelayDataType = GetComponentTypeHandle <ShootDelayData>();
            ShootJob shootJob = new ShootJob()
            {
                deltaTime = Time.DeltaTime,
                ShootDelayDataTypeHandle = shootDelayDataType
            };

            shootJob.Run(group);
        }