Ejemplo n.º 1
0
 public JobHandleWithMainThreadWork(JobHandle handle, JobDependencyTracker tracker)
 {
     this.handle    = handle;
     this.tracker   = tracker;
     this.coroutine = null;
 }
Ejemplo n.º 2
0
 public JobHandleWithMainThreadWork(IEnumerator <JobHandle> handles, JobDependencyTracker tracker)
 {
     this.coroutine = handles;
     this.tracker   = tracker;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Jobified version of <see cref="Physics.RaycastNonAlloc"/>
        /// </summary>
        /// <param name="commands">Array of commands to perform. Each <see cref="RaycastCommand.maxHits"/> should be 1</param>
        /// <param name="maxHits">Max hits count per command</param>
        /// <param name="minStep">Minimal distance each Raycast should progress</param>
        public RaycastAllCommand(NativeArray <RaycastCommand> commands, NativeArray <RaycastHit> results, int maxHits, JobDependencyTracker dependencyTracker, float minStep = 0.0001f)
        {
            if (maxHits <= 0)
            {
                throw new System.ArgumentException("maxHits should be greater than zero");
            }
            if (results.Length < commands.Length * maxHits)
            {
                throw new System.ArgumentException("Results array length does not match maxHits count");
            }
            if (minStep < 0f)
            {
                throw new System.ArgumentException("minStep should be more or equal to zero");
            }

            this.results  = results;
            this.maxHits  = maxHits;
            this.minStep  = minStep;
            this.commands = commands;

            semiResults = dependencyTracker.NewNativeArray <RaycastHit>(maxHits * commands.Length, Allocator.TempJob);
        }