IEnumerator GenerateRange() { int itx = TileX; int itz = TileZ; //bExport = false; for (int xx = itx - RangeSize; xx <= itx + RangeSize; xx++) { for (int zz = itz - RangeSize; zz <= itz + RangeSize; zz++) { TileX = xx; TileZ = zz; TileDone = 0; TileDone++; Debug.Log("Doing " + TileX + "," + TileZ); EditorCoroutine.StartCoroutine(GenerateAll()); while (TileDone > 0) { // Debug.Log(TileDone); this.Repaint(); yield return(new WaitForSeconds(1f)); } Debug.Log("Done " + TileX + "," + TileZ); } } if (bExport) { Debug.Log("Exporting AssetBundles"); ExportAssetBundle(); } }
IEnumerator DownloadHeightMapNeighboursCo() { HeightmapDone = 1; int itx = TileX; int itz = TileZ; Setup(); HeightmapDone = 1; Debug.Log("Getting Root Heightmap " + TileX + "," + TileZ); EditorCoroutine.StartCoroutine(DownloadHeightMapCo()); while (HeightmapDone > 0) { this.Repaint(); yield return(new WaitForSeconds(0.1f)); } TileX = itx + 1; Setup(); HeightmapDone = 1; Debug.Log("Getting Heightmap Neighbour " + TileX + "," + TileZ); EditorCoroutine.StartCoroutine(DownloadHeightMapCo()); while (HeightmapDone > 0) { this.Repaint(); yield return(new WaitForSeconds(0.1f)); } Debug.Log("Done " + TileX + "," + TileZ); TileX = itx + 1; TileZ = itz + 1; Setup(); Debug.Log("Getting Heighmap Neighbour " + TileX + "," + TileZ); HeightmapDone = 1; EditorCoroutine.StartCoroutine(DownloadHeightMapCo()); while (HeightmapDone > 0) { this.Repaint(); yield return(new WaitForSeconds(0.1f)); } Debug.Log("Done " + TileX + "," + TileZ); TileX = itx; TileZ = itz + 1; Setup(); Debug.Log("Getting Heightmap Neighbour " + TileX + "," + TileZ); HeightmapDone = 1; EditorCoroutine.StartCoroutine(DownloadHeightMapCo()); while (HeightmapDone > 0) { this.Repaint(); yield return(new WaitForSeconds(0.1f)); } Debug.Log("Done heightmap " + TileX + "," + TileZ); TileX = itx; TileZ = itz; Setup(); NeighbourDone = 0; }
void DownloadHeightmapNeighbours() { NeighbourDone = 1; CreateFolders(); Done = 1; HeightmapDone = 1; EditorCoroutine.StartCoroutine(DownloadHeightMapNeighboursCo()); }
void OnGUI() { //GUI.skin = EditorGUIUtility.Load(GetPath(ePATHSPEC.SKINPATH)) as GUISkin; GUI.skin = mySkin; // OnSceneGUI(); //Handles.Draw(rect, camera, CameraDrawMode.Textured) // OnDrawGizmos(); ZoomLevel = EditorGUILayout.IntField("Zoom Level", ZoomLevel); GUILayout.BeginHorizontal(); if (GUILayout.Button("-")) { TileX--; } TileX = EditorGUILayout.IntField("TileX", TileX); if (GUILayout.Button("+")) { TileX++; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("-")) { TileZ--; } TileZ = EditorGUILayout.IntField("TileZ", TileZ); if (GUILayout.Button("+")) { TileZ++; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Set As Start Point") == true) { SetStartPoint(); } GUILayout.EndHorizontal(); GUILayout.Label("Creation", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); if (GUILayout.Button("Auto Generate 1 Tile") == true) { EditorCoroutine.StartCoroutine(GenerateAll()); } bExport = EditorGUILayout.Toggle("Export Bundle", bExport); GUILayout.EndHorizontal(); GUILayout.Label("Range", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); RangeSize = EditorGUILayout.IntField("Range", RangeSize); if (GUILayout.Button("Generate") == true) { EditorCoroutine.StartCoroutine(GenerateRange()); } GUILayout.EndHorizontal(); if (GUILayout.Button("Download Neighbouring Heightmaps") == true) { DownloadHeightmapNeighbours(); } GUILayout.Label((TileX - RangeSize) + "," + (TileZ - RangeSize) + "-" + (TileZ + RangeSize) + "," + (TileZ + RangeSize), EditorStyles.boldLabel); GUILayout.BeginHorizontal(); bCreateGrass = EditorGUILayout.Toggle("Create Grass", bCreateGrass); GUILayout.EndHorizontal(); GUILayout.Label("Components", EditorStyles.boldLabel); GUILayout.Label("Download", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); if (GUILayout.Button("Basemap") == true) { DownloadBasemap(); } // GUILayout.Box(HeightMap, GUILayout.Width(64), GUILayout.Height(64)); //EditorGUI.DrawPreviewTexture(new Rect(25, 60, 100, 100), HeightMap); if (GUILayout.Button("Heightmap") == true) { DownloadHeightMap(); } if (GUILayout.Button("NormalMap") == true) { DownloadNormalMap(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Create Continuity") == true) { CreateContiuousTiles(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Generate Mesh Terrain") == true) { GenerateMeshTerrain(); } GUILayout.EndHorizontal(); GUILayout.Label("Generate", EditorStyles.boldLabel); if (GUILayout.Button("Get OSM Tile") == true) { DownloadOSM(); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Roads") == true) { DownloadRoads(); } if (GUILayout.Button("Water") == true) { DownloadWater(); } if (GUILayout.Button("Buildings") == true) { DownloadBuildings(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Road Network") == true) { GenerateRoadNetwork(); } if (GUILayout.Button("Road Network Test") == true) { GenerateRoadNetworkTest(); } if (GUILayout.Button("Polygon Test") == true) { PolygonTest(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Get Geo Info") == true) { GetGeoInfo(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Fix Terrain Mesh") == true) { FixMesh(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Generate Prefab") == true) { GeneratePrefab(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Export Assetbundle") == true) { ExportAssetBundle(); } GUILayout.EndHorizontal(); GUILayout.Label("Bundle Export Location"); ExportLocation = GUILayout.TextField(ExportLocation); MajorRoadMaterial = EditorGUILayout.ObjectField("Major Road Material", MajorRoadMaterial, typeof(Material)) as Material; RoadMaterial = EditorGUILayout.ObjectField("Road Material", RoadMaterial, typeof(Material)) as Material; SmallStreetMaterial = EditorGUILayout.ObjectField("Small Road Material", SmallStreetMaterial, typeof(Material)) as Material; PathMaterial = EditorGUILayout.ObjectField("Path Material", PathMaterial, typeof(Material)) as Material; RailwayMaterial = EditorGUILayout.ObjectField("Railway Material", RailwayMaterial, typeof(Material)) as Material; WaterMaterial = EditorGUILayout.ObjectField("Water Material", WaterMaterial, typeof(Material)) as Material; BuildingMaterial = EditorGUILayout.ObjectField("Building Material", BuildingMaterial, typeof(Material)) as Material; RoofMaterial = EditorGUILayout.ObjectField("Roof Material", RoofMaterial, typeof(Material)) as Material; ServiceRoadMaterial = EditorGUILayout.ObjectField("Service Road Material", ServiceRoadMaterial, typeof(Material)) as Material; if (GUILayout.Button("STOP")) { Stop = true; } GUILayout.BeginHorizontal(); GUILayout.Label("Progress", EditorStyles.boldLabel); EditorGUILayout.FloatField(progress); Done = EditorGUILayout.IntField(Done); GUILayout.EndHorizontal(); }
void DownloadNormalMap() { Done++; CreateFolders(); EditorCoroutine.StartCoroutine(DownloadNormalMapCo()); }
void DownloadHeightMap() { HeightmapDone++; CreateFolders(); EditorCoroutine.StartCoroutine(DownloadHeightMapCo()); }
//TODO get wiki info http://api.geonames.org/findNearbyWikipedia?lat=47&lng=9&username=demo void GetGeoInfo() { Done++; EditorCoroutine.StartCoroutine(GetGeoInfoCo()); }
void DownloadRoads() { Done++; CreateFolders(); EditorCoroutine.StartCoroutine(DownloadFeaturesCo("roads", Paths.GetPath(ePATHSPEC.ROADSPATH), GenerateRoads)); }
void DownloadWater() { Done++; CreateFolders(); EditorCoroutine.StartCoroutine(DownloadFeaturesCo("water", Paths.GetPath(ePATHSPEC.WATERPATH), GenerateWater)); }
void DownloadBuildings() { Done++; CreateFolders(); EditorCoroutine.StartCoroutine(DownloadFeaturesCo("buildings", Paths.GetPath(ePATHSPEC.BUILDINGSPATH), GenerateBuildings)); }
void DownloadOSM() { Done++; EditorCoroutine.StartCoroutine(DownloadOSMCo()); }
private IEnumerator StartJoinableCoroutine(int index, IEnumerator coroutine) { yield return(EditorCoroutine.StartCoroutine(coroutine)); _subTasks[index] = true; }
public EditorCoroutine WaitForAll() { return(EditorCoroutine.StartCoroutine(WaitForAllSubtasks())); }
public void StartSubtask(IEnumerator routine) { _subTasks.Add(false); EditorCoroutine.StartCoroutine(StartJoinableCoroutine(_subTasks.Count - 1, routine)); }