コード例 #1
0
 public void RunImmediate()
 {
     if (isLayerLayer)
     {
         var hitArrayA = new NativeBitArray(layerA.Count, Allocator.Temp, NativeArrayOptions.ClearMemory);
         var hitArrayB = new NativeBitArray(layerB.Count, Allocator.Temp, NativeArrayOptions.ClearMemory);
         var processor = new DebugFindPairsLayerLayerProcessor {
             hitArrayA = hitArrayA, hitArrayB = hitArrayB
         };
         Physics.FindPairs(layerA, layerB, processor).RunImmediate();
         var job = new DebugFindPairsDrawJob
         {
             layer      = layerA,
             hitArray   = hitArrayA,
             hitColor   = hitColor,
             missColor  = missColor,
             drawMisses = drawMisses
         };
         for (int i = 0; i < layerA.Count; i++)
         {
             job.Execute(i);
         }
         job.hitArray = hitArrayB;
         job.layer    = layerB;
         for (int i = 0; i < layerB.Count; i++)
         {
             job.Execute(i);
         }
     }
     else
     {
         var hitArray  = new NativeBitArray(layerA.Count, Allocator.Temp, NativeArrayOptions.ClearMemory);
         var processor = new DebugFindPairsLayerSelfProcessor {
             hitArray = hitArray
         };
         Physics.FindPairs(layerA, processor).RunImmediate();
         var job = new DebugFindPairsDrawJob
         {
             layer      = layerA,
             hitArray   = hitArray,
             hitColor   = hitColor,
             missColor  = missColor,
             drawMisses = drawMisses
         };
         for (int i = 0; i < layerA.Count; i++)
         {
             job.Execute(i);
         }
     }
 }
コード例 #2
0
 public JobHandle ScheduleParallel(JobHandle inputDeps = default)
 {
     if (isLayerLayer)
     {
         var hitArrayA = new NativeBitArray(layerA.Count, Allocator.TempJob, NativeArrayOptions.ClearMemory);
         var hitArrayB = new NativeBitArray(layerB.Count, Allocator.TempJob, NativeArrayOptions.ClearMemory);
         var processor = new DebugFindPairsLayerLayerProcessor {
             hitArrayA = hitArrayA, hitArrayB = hitArrayB
         };
         var jh  = Physics.FindPairs(layerA, layerB, processor).ScheduleSingle(inputDeps);
         var job = new DebugFindPairsDrawJob
         {
             layer      = layerA,
             hitArray   = hitArrayA,
             hitColor   = hitColor,
             missColor  = missColor,
             drawMisses = drawMisses
         };
         jh           = job.ScheduleParallel(layerA.Count, 64, jh);
         job.hitArray = hitArrayB;
         job.layer    = layerB;
         jh           = job.ScheduleParallel(layerB.Count, 64, jh);
         jh           = hitArrayA.Dispose(jh);
         return(hitArrayB.Dispose(jh));
     }
     else
     {
         var hitArray  = new NativeBitArray(layerA.Count, Allocator.TempJob, NativeArrayOptions.ClearMemory);
         var processor = new DebugFindPairsLayerSelfProcessor {
             hitArray = hitArray
         };
         var jh = Physics.FindPairs(layerA, processor).ScheduleSingle(inputDeps);
         jh = new DebugFindPairsDrawJob
         {
             layer      = layerA,
             hitArray   = hitArray,
             hitColor   = hitColor,
             missColor  = missColor,
             drawMisses = drawMisses
         }.ScheduleParallel(layerA.Count, 64, jh);
         return(hitArray.Dispose(jh));
     }
 }
コード例 #3
0
 public void Run()
 {
     if (isLayerLayer)
     {
         var hitArrayA = new NativeBitArray(layerA.Count, Allocator.TempJob, NativeArrayOptions.ClearMemory);
         var hitArrayB = new NativeBitArray(layerB.Count, Allocator.TempJob, NativeArrayOptions.ClearMemory);
         var processor = new DebugFindPairsLayerLayerProcessor {
             hitArrayA = hitArrayA, hitArrayB = hitArrayB
         };
         Physics.FindPairs(layerA, layerB, processor).Run();
         var job = new DebugFindPairsDrawJob
         {
             layer      = layerA,
             hitArray   = hitArrayA,
             hitColor   = hitColor,
             missColor  = missColor,
             drawMisses = drawMisses
         };
         job.Run(layerA.Count);
         job.hitArray = hitArrayB;
         job.layer    = layerB;
         job.Run(layerB.Count);
         hitArrayA.Dispose();
         hitArrayB.Dispose();
     }
     else
     {
         var hitArray  = new NativeBitArray(layerA.Count, Allocator.TempJob, NativeArrayOptions.ClearMemory);
         var processor = new DebugFindPairsLayerSelfProcessor {
             hitArray = hitArray
         };
         Physics.FindPairs(layerA, processor).Run();
         new DebugFindPairsDrawJob
         {
             layer      = layerA,
             hitArray   = hitArray,
             hitColor   = hitColor,
             missColor  = missColor,
             drawMisses = drawMisses
         }.Run(layerA.Count);
         hitArray.Dispose();
     }
 }