// private void generateRoads(){ // // Roads roads = new Roads (this); // roads.createRoads (this); // // // } private void generateRoads(){ RoadGenerator roadGen = new RoadGenerator (this); roadGen.generate (); roadPaths = roadGen.paths; DrawRoads drawRaod = new DrawRoads (m_terrainSize, m_heightMapSize, road); drawRaod.pathShader = pathShader; for (int i =0; i< cityCenters.Count; i++) for (int j=i+1; j< cityCenters.Count; j++) { if (roadPaths[i,j].length == -1 ) continue; if(roadPaths[i,j].points.Count<2) continue; bool skip = false; for (int h=0; h< cityCenters.Count; h++){ if ( h==i || h==j) continue; if (roadPaths[i,j].length >=(0.85f)*(roadPaths[i,h].length + roadPaths[h,j].length) ) skip =true; if (roadPaths[i,h].length == -1 || roadPaths[h,j].length == -1) skip = false; } if (skip) continue; drawRaod.createRoads(roadPaths[i,j].points); } }