/// <summary> /// 添加子地图 /// </summary> /// <param name="s"></param> public void AddSubMap(SubMapData s) { if (s == null) { return; } if (ListMap == null) { ListMap = new List <SubMapData>(); } ListMap.Add(s); }
/// <summary> /// 构建 /// </summary> /// <param name="data"></param> public void Create(SubMapData data) { if (data == null) { return; } List <GolfAIPoint> lp = new List <GolfAIPoint>(); for (int i = 0; i < data.Listpt.Count; i++) { lp.Add(new GolfAIPoint(data.Listpt[i])); } List <GolfMaptriangle> ListT = new List <GolfMaptriangle>(); int total = data.ListTriangle.Count / 3; for (int i = 0; i < total; i++) { int index = i * 3; GolfMaptriangle c = new GolfMaptriangle(lp[data.ListTriangle[index]], lp[data.ListTriangle[index + 1]], lp[data.ListTriangle[index + 2]]); ListT.Add(c); } List <GolfAIMapPolygon> lpoly = new List <GolfAIMapPolygon>(); total = data.ListPoly.Count; for (int i = 0; i < total; i++) { List <GolfMaptriangle> l = new List <GolfMaptriangle>(); for (int j = 0; j < data.ListPoly[i].ListTriangle.Count; j++) { l.Add(ListT[data.ListPoly[i].ListTriangle[j]]); } List <GolfAIPoint> ll = new List <GolfAIPoint>(); for (int j = 0; j < data.ListPoly[i].ListPt.Count; j++) { ll.Add(lp[data.ListPoly[i].ListPt[j]]); } lpoly.Add(new GolfAIMapPolygon(l, ll, data.ListPoly[i].m_normal)); } Create(lp, ListT, lpoly, data.m_Type); }