public static void SceneDebug() { Debuger_K.ClearGeneric(); float gs = PathFinder.gridSize; Vector3 add = new Vector3(gs * 0.5f, 0, gs * 0.5f); StringBuilder sb = new StringBuilder(); foreach (var item in content) { sb.AppendLine(item.Value.lastUpdate.ToString()); } Debuger_K.AddLabelFormat(new Vector3(startX * gs, 0, startZ * gs), "Map space {0}\nCount {1}\n{2}", mapSpace, content.Count, sb); for (int x = startX; x < endX + 1; x++) { Debuger_K.AddLine(new Vector3(x, 0, startZ) * gs, new Vector3(x, 0, endZ) * gs, Color.blue); } for (int z = startZ; z < endZ + 1; z++) { Debuger_K.AddLine(new Vector3(startX, 0, z) * gs, new Vector3(endX, 0, z) * gs, Color.blue); } System.Random random = new System.Random(); for (int x = startX; x < endX; x++) { for (int z = startZ; z < endZ; z++) { ChunkContent content; TryGetChunkContent(x, z, out content); Vector3 p = (new Vector3(x, 0, z) * gs) + add; Debuger_K.AddLabelFormat(p, "x: {0}\nz: {1}", x, z); Color color = new Color(1, 0, 0, 0.1f); if (content != null && content.Count != 0) { color = new Color(0, 1, 0, 0.1f); } Debuger_K.AddTriangle(new Vector3(x, 0, z) * gs, (new Vector3(x + 1, 0, z) * gs), (new Vector3(x, 0, z + 1) * gs), color, false); Debuger_K.AddTriangle(new Vector3(x + 1, 0, z + 1) * gs, (new Vector3(x + 1, 0, z) * gs), (new Vector3(x, 0, z + 1) * gs), color, false); if (content != null && content.Count != 0) { Color cColor = new Color(random.Next(100) / 100f, random.Next(100) / 100f, random.Next(100) / 100f, 1f); foreach (var item in content) { Debuger_K.AddBounds(item.chunkContentBounds, cColor); Debuger_K.AddLine(p, item.chunkContentBounds.center, cColor); } } } } }
void DrawBranchRecursive(QuadTreeBranch branch, float offset = 0f, float offsetDelta = 0f) { if (branch == null) { return; } Bounds2D branchBounds = branch.bounds; Debuger_K.AddBounds(branchBounds, Color.green); Vector3 curPos = branchBounds.centerVector3; for (int i = 0; i < branch.list.Count; i++) { Bounds2D countentBounds = branch.list[i].bounds; Debuger_K.AddBounds(countentBounds, Color.blue); Debuger_K.AddLine(curPos, countentBounds.centerVector3, Color.magenta); } for (int i = 0; i < 4; i++) { if (branch.branches[i] != null) { DrawBranchRecursive(branch.branches[i]); } } }