public void ChangeMapView() { if (isArOn) { //Map.Initialize() //ArCamera.GetComponent<Vuforia.VuforiaBehaviour>(). CanvasForArCamera.SetActive(false); ArCamera.SetActive(false); CanvasForMainCamera.SetActive(true); MainCamera.SetActive(true); Map.Options.extentOptions.extentType = MapExtentType.CameraBounds; Map.ResetMap(); isArOn = false; } else { CanvasForMainCamera.SetActive(false); MainCamera.SetActive(false); CanvasForArCamera.SetActive(true); ArCamera.SetActive(true); Map.Options.extentOptions.extentType = MapExtentType.RangeAroundTransform; Map.ResetMap(); isArOn = true; } }
private static void CreateCity(AbstractMap m) { if (m.MapVisualizer != null) { m.ResetMap(); } m.MapVisualizer = ScriptableObject.CreateInstance <MapVisualizer>(); m.Initialize(new Mapbox.Utils.Vector2d(40.764170691358686f, -73.97670925665614f), 16); }
public void ResetMap() { SpawnOnMapController.RefreshDungeons(DungeonHandler.GetDungeonsList()); Mapbox.Utils.Vector2d centerLatLon = _map.CenterLatitudeLongitude; _map.ResetMap(); _map.Initialize(centerLatLon, 14); }
/// Online User Button's OnClick Event private void LocateUserLocation() { mapManager.ResetMap(); GameObject gObj = EventSystem.current.currentSelectedGameObject; string buttonText = gObj.GetComponentInChildren <TextMeshProUGUI>().text.ToString(); foreach (User user in onlineUsers) { ///Which locates the user location that belongs to clicked button if (buttonText.ToLower().Equals(user.Username.ToLower())) { ///Find Location of user and move the camera there Camera.main.transform.position = cameraStartingPos; Camera.main.transform.rotation = cameraStartingRotation; mapManager.UpdateMap(new Vector2d((double)user.Latitude, (double)user.Longitude), 16f); /// This is the solution of altitude problem of avatar RefreshOnlineUsers(); break; } } }
private static void OnScriptsReloaded() { if (Application.isEditor) { AbstractMap abstractMap = UnityEngine.Object.FindObjectOfType <AbstractMap>(); if (abstractMap == null) { return; } UnityTile[] unityTiles = abstractMap.GetComponentsInChildren <UnityTile>(); for (int i = 0; i < unityTiles.Length; i++) { UnityEngine.Object.DestroyImmediate(unityTiles[i].gameObject); } abstractMap.DestroyChildObjects(); if (EditorApplication.isPlaying) { abstractMap.ResetMap(); return; } if (abstractMap.IsEditorPreviewEnabled == true) { if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } else { abstractMap.DisableEditorPreview(); abstractMap.EnableEditorPreview(); } } } }
void OnGUI() { if (citySimulatorMap == null) { citySimulatorMap = GameObject.Find("CitySimulatorMap"); } if (abstractMap == null) { abstractMap = citySimulatorMap?.GetComponent <AbstractMap>(); } minHeight = EditorGUILayout.FloatField("Minimum Building Height:", minHeight); maxHeight = EditorGUILayout.FloatField("Maximum Building Height:", maxHeight); if (GUILayout.Button("Test Router")) { TestRoute(); } if (GUILayout.Button("Edit Mode Build")) { if (abstractMap.MapVisualizer != null) { abstractMap.ResetMap(); } abstractMap.MapVisualizer = ScriptableObject.CreateInstance <MapVisualizer>(); abstractMap.Initialize(new Mapbox.Utils.Vector2d(40.764170691358686f, -73.97670925665614f), 16); } if (GUILayout.Button("1. Setup Objects")) { RenameRoads(citySimulatorMap.transform); OptimizeRenderer(citySimulatorMap.transform); foreach (Transform tile in citySimulatorMap.transform) { SortChildrenByName(tile); } GroupAllByBlocks(citySimulatorMap.transform); SplitAllBlocks(citySimulatorMap.transform); SortHeirarchy(citySimulatorMap.transform); Transform road = null; foreach (Transform tile in citySimulatorMap.transform) { for (int i = 0; i < tile.childCount; i++) { Transform current = tile.GetChild(i); if (current.name.Substring(0, 4) == "Road") { road = current; continue; } CombineParentAndChildrenMeshes(current, !EditorApplication.isPlaying); } if (road != null && EditorApplication.isPlaying) { Destroy(road.gameObject); } else if (road != null && !EditorApplication.isPlaying) { DestroyImmediate(road.gameObject); } } } if (GUILayout.Button("2. Box buildings")) { Material material = Resources.Load("Materials/WhiteLOD") as Material; foreach (Transform tile in citySimulatorMap.transform) { foreach (Transform building in tile) { if (building.childCount > 0) { continue; } if (IsTall(building)) { new BoxBuilder(building).Build(material, Building.Tall); } else { new BoxBuilder(building).Build(material, Building.Short); } //DestroyImmediate(building.GetComponent<MeshCollider>()); } } } if (GUILayout.Button("3. Combine Mesh in Tiles")) { foreach (Transform tile in citySimulatorMap.transform) { GroupByTile(tile); } } if (GUILayout.Button("Build bitmap")) { Debug.Log(JsonUtility.ToJson(new Buildings())); } }