using System; using System.Collections.Generic; using UnityEngine; using Unity.Burst; using Unity.Collections; using Unity.Jobs; using Unity.Mathematics; [BurstCompile] public struct ConstructQuadTreeJob : IJobParallelFor { [ReadOnly] public Rect rect; [ReadOnly] public NativeArray positions; public NativeArray quadTree; public NativeArray sortedIndices; const int capacity = 4; public void Execute(int index) { for (int i = 0; i < positions.Length; i++) {} // [ (0, ) ] // A // B C // D E F G // [A, B, C, D, E, F, G] } } [BurstCompile] public struct FindNearestEnemyQuadTreeJob : IJobParallelFor { [ReadOnly] public NativeArray bluePositions; [ReadOnly] public NativeArray redPositions; [ReadOnly] public NativeArray quadTree; public NativeArray nearestEnemyOfBlueIndex; public NativeArray nearestEnemyOfRedIndex; public void Execute(int index) { } }