public void Remove(VectorMapLayer mapLayer) { mapLayers.Remove(mapLayer); mapLayer.PatchData.patch.SetMapLayer(null); // If it's the last patch then remove the data layer var dataLayer = mapLayer.PatchData.patch.DataLayer; if (!dataLayer.HasLoadedPatchesInView()) { visibleDataLayers.Remove(dataLayer); } OnShowMapLayer?.Invoke(mapLayer, false); Destroy(mapLayer.gameObject); }
public void Add(PointMapLayer mapLayer, PointData pointData) { mapLayer.transform.SetParent(transform, false); mapLayer.Init(map, pointData); #if UNITY_EDITOR mapLayer.name = pointData.patch.DataLayer.Name; if (!string.IsNullOrWhiteSpace(pointData.patch.Filename)) { mapLayer.name += Patch.GetFileNamePatch(pointData.patch.Filename); } #endif var dataLayer = pointData.patch.DataLayer; mapLayer.SetColor(dataLayer.Color); mapLayers.Add(mapLayer); pointData.patch.SetMapLayer(mapLayer); if (!visibleDataLayers.Contains(dataLayer)) { visibleDataLayers.Add(dataLayer); } OnShowMapLayer?.Invoke(mapLayer, true); if (VectorMapLayer.ManualGammaCorrection) { mapLayer.SetGamma(gamma); } else { UpdateGamma(mapLayer); } }