public static List <Marker> getAllMarkers() { pathToMarkerHistory = Application.streamingAssetsPath + "/markerHistory.json"; MarkerHistoryJsonString = File.ReadAllText(pathToMarkerHistory); MarkerContainer mc = JsonUtility.FromJson <MarkerContainer>(MarkerHistoryJsonString); return(mc.markers); }
private void OnDestroy() { StopGridGeneration(); if (markerContainer != null) { Destroy(markerContainer.gameObject); markerContainer = null; } }
public void Activate() { isActive = true; inputHandler.OnLeftMouseUp += OnSetPoint; inputHandler.OnRightMouseUp += OnCancel; if (markerContainer == null) { markerContainer = Instantiate(markerContainerPrefab, map.transform, false); markerContainer.Init(); } }
public static void addMarkerToHistory(string name, string text) { pathToMarkerHistory = Application.streamingAssetsPath + "/markerHistory.json"; MarkerHistoryJsonString = File.ReadAllText(pathToMarkerHistory); MarkerContainer mc = JsonUtility.FromJson <MarkerContainer>(MarkerHistoryJsonString); foreach (Marker mark in mc.markers) { if (mark.name == name) { mc.markers.Remove(mark); break; } } mc.markers.Add(new Marker(name, text)); string markersjson = JsonUtility.ToJson(mc); File.WriteAllText(pathToMarkerHistory, markersjson); }