diff options
author | chai <215380520@qq.com> | 2023-05-09 10:17:45 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-05-09 10:17:45 +0800 |
commit | c35533e31efe30121a7c61a725fdaaba47714296 (patch) | |
tree | b25bc22f00911f376c741b89b0591d2d48565e79 /marching/Assets/Scripts/Physics/TestQuadtree.cs | |
parent | d2a574ba76c56c340d8ac0ad841344664bc2cc59 (diff) |
*misc
Diffstat (limited to 'marching/Assets/Scripts/Physics/TestQuadtree.cs')
-rw-r--r-- | marching/Assets/Scripts/Physics/TestQuadtree.cs | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/marching/Assets/Scripts/Physics/TestQuadtree.cs b/marching/Assets/Scripts/Physics/TestQuadtree.cs index 3159853..1cbb64d 100644 --- a/marching/Assets/Scripts/Physics/TestQuadtree.cs +++ b/marching/Assets/Scripts/Physics/TestQuadtree.cs @@ -10,47 +10,22 @@ namespace mh [DefaultExecutionOrder(-1000)] public class TestQuadtree : MonoBehaviour { - public static mh.Quadtree m_Quadtree; - public static mh.Quadtree quadtree { get { return m_Quadtree; } } private void Awake() { - m_Quadtree = new Quadtree(0, new Vector4(0, 0, 30, 30)); - } - - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { } private void FixedUpdate() { - m_Quadtree.Clear(false); var pos = UnitManager.hero.transform.position; - m_Quadtree.Rebound(new Vector4(pos.x, pos.y, 50, 50)); - var objs = PhysicsManager.quadTreeObjects; - for (int i = 0; i < objs.Count; ++i) - { - TestQuadtree.quadtree.Insert(objs[i]); - } + PhysicsManager.Instance.quadtreeCollisionRange = new Vector4(pos.x, pos.y, 50, 50); + PhysicsManager.Instance.quadtreeHurtboxRange = new Vector4(pos.x, pos.y, 50, 50); + PhysicsManager.Instance.Update(); } private void OnDrawGizmos() { - Color c = Gizmos.color; - Gizmos.color = Color.red; - m_Quadtree?.Iterate((t) => { - Vector3 pos = new Vector3(t.x, t.y, 0); - Vector3 size = new Vector3(t.w, t.h, 1); - Gizmos.DrawWireCube(pos, size); - }); - Gizmos.color = c; + PhysicsManager.Instance.Debug(); } } |