/// <summary> /// ³õʼ»¯graphNodeÕ¤¸ñÆ÷ /// </summary> public void InitRasterizer(int inCellSize = 4000) { if (this.graphs == null || this.graphs.Length == 0) { return; } rasterizer = new GraphNodeRasterizer(); Int2 min = new Int2(2147483647, 2147483647); Int2 max = new Int2(-2147483648, -2147483648); for (int j = 0; j < this.graphs.Length; j++) { RecastGraph recastGraph2 = this.graphs[j] as RecastGraph; if (recastGraph2 == null) { return; } recastGraph2.GetNodes(delegate(GraphNode node) { TriangleMeshNode triangleMeshNode = node as TriangleMeshNode; if (triangleMeshNode != null) { Int2 xz = triangleMeshNode.GetVertex(0).xz; Int2 xz2 = triangleMeshNode.GetVertex(1).xz; Int2 xz3 = triangleMeshNode.GetVertex(2).xz; min.Min(ref xz); min.Min(ref xz2); min.Min(ref xz3); max.Max(ref xz); max.Max(ref xz2); max.Max(ref xz3); } return(true); }); } rasterizer.Init(min, max.x - min.x, max.y - min.y, inCellSize); for (int k = 0; k < this.graphs.Length; k++) { RecastGraph recastGraph3 = this.graphs[k] as RecastGraph; if (recastGraph3 != null) { recastGraph3.GetNodes(delegate(GraphNode node) { TriangleMeshNode triangleMeshNode = node as TriangleMeshNode; if (triangleMeshNode != null) { Int2 xz = triangleMeshNode.GetVertex(0).xz; Int2 xz2 = triangleMeshNode.GetVertex(1).xz; Int2 xz3 = triangleMeshNode.GetVertex(2).xz; rasterizer.AddTriangle(ref xz, ref xz2, ref xz3, triangleMeshNode); } return(true); }); } } }