1
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Quadtree;
|
||||
using Quadtree.Items;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit.WorldNodes
|
||||
@@ -32,9 +34,19 @@ namespace BITKit.WorldNodes
|
||||
[ExecuteInEditMode]
|
||||
public class WorldNodeService : MonoBehaviour,IWorldNodeService
|
||||
{
|
||||
private class WorldNodeProxy : IItem<WorldNodeProxy, Node<WorldNodeProxy>>
|
||||
{
|
||||
public Bounds Bounds;
|
||||
public Bounds GetBounds()=>Bounds;
|
||||
public Node<WorldNodeProxy> ParentNode { get; set; }
|
||||
public void QuadTree_Root_Initialized(IQuadtreeRoot<WorldNodeProxy, Node<WorldNodeProxy>> root)
|
||||
{
|
||||
}
|
||||
}
|
||||
public static event Action OnDrawGizmo;
|
||||
public static readonly CacheList<IWorldNode> WorldNodeList = new();
|
||||
public static IWorldNode[] WorldNodes => WorldNodeList.ValueArray;
|
||||
private static QuadtreeRoot<WorldNodeProxy, Node<WorldNodeProxy>> _QuadtreeRoot;
|
||||
public static IWorldNode[] GetNodes(Vector3 position, float radius)
|
||||
{
|
||||
return WorldNodes.Where(node => InRange(position, node, radius))
|
||||
@@ -77,6 +89,13 @@ namespace BITKit.WorldNodes
|
||||
{
|
||||
WorldNodeList.Clear();
|
||||
}
|
||||
|
||||
[SerializeField] private Vector3 size;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_QuadtreeRoot = new QuadtreeRoot<WorldNodeProxy, Node<WorldNodeProxy>>(transform.position,size);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user