43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
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<float2> positions;
|
|
public NativeArray<float4> quadTree;
|
|
public NativeArray<int> 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<float2> bluePositions;
|
|
[ReadOnly] public NativeArray<float2> redPositions;
|
|
[ReadOnly] public NativeArray<float4> quadTree;
|
|
public NativeArray<long> nearestEnemyOfBlueIndex;
|
|
public NativeArray<long> nearestEnemyOfRedIndex;
|
|
|
|
public void Execute(int index)
|
|
{
|
|
}
|
|
}
|