void CreateNewChart(Texture2D map) { chart = ChartStatic.Construct(map); chart.name = "New Chart"; LoadChart(chart); SaveChart(); }
void CreateNewChart(Texture2D map) { properties.chart = ChartStatic.Construct(map); properties.chart.name = "New Chart"; LoadChart(properties.chart); SaveChart(); }
ChartStatic CarveEntrancesIntoChart(RawChart chart, Maze maze, Coord coord) { IEnumerable<MapEntrance> entrances = GetEntrances(maze, coord); chart.Seed = seed; var staticModule = MapGenStaticMap.Construct(chart.Map); var carvedModule = MapGenEntranceCarver.Construct(staticModule, entrances); return ChartStatic.ReplaceMap(carvedModule.Generate(seed), chart); }
/// <summary> /// Replaces the map in the chart, creating a new static chart with the same markers and metadata as the original. /// Note that the copy may be shallow. /// </summary> public static ChartStatic ReplaceMap(Map map, RawChart chart) { ChartStatic newChart = Construct(map); newChart.name = chart.name; newChart.markers = chart.Markers.ToList(); newChart.metaData = chart.MetaData; return(newChart); }
void DrawChartField() { EditorGUI.BeginChangeCheck(); var newChart = (ChartStatic)EditorGUILayout.ObjectField(chart, typeof(ChartStatic), false); if (EditorGUI.EndChangeCheck()) { MarkChartDirty(); chart = newChart; LoadChart(chart); } }
public static ChartStatic Construct(Map map) { if (map == null) { throw new ArgumentNullException(); } Texture2D mapTexture = map.ToTexture(); ChartStatic chart = Construct(mapTexture); chart.cachedMap = map; return(chart); }
void LoadChart(ChartStatic chart) { if (chart == null) { markers.Clear(); chartName = string.Empty; } else { markers = chart.Markers.Select(m => MarkerNode.Construct(m)).ToList(); chartName = chart.name; } }
public static ChartStatic Construct(Texture2D map) { if (map == null) { throw new ArgumentNullException(); } ChartStatic chart = CreateInstance <ChartStatic>(); chart.texture = map; chart.metaData = new MetaData(); chart.markers = new List <RawMarker>(); return(chart); }
void Load() { var save = ChartEditorSave.Load(); if (save != null) { chart = save.chart; customPalette = save.palette; scale = save.scale; showGrids = save.showGrids; snapSetting = save.snapSetting; panelChartFoldout = save.panelChartFoldout; panelEditorOptionsFoldout = save.panelEditorOptionsFoldout; panelMarkerOptionsFoldout = save.panelMarkerOptionsFoldout; } }
public override Dictionary <Coord, RawChart> GetCharts(Maze maze) { ValidateCharts(); random = new System.Random(seed); Coord[] cells = maze.GetCells(); var chartsByCoord = new Dictionary <Coord, RawChart>(); for (int i = 0; i < cells.Length; i++) { Coord cell = cells[i]; ChartStatic[] candidateCharts = DetermineChartCandidates(maze, cell); RawChart chart = candidateCharts[random.Next(0, candidateCharts.Length)]; ChartStatic carvedChart = CarveEntrancesIntoChart(chart, maze, cell); chartsByCoord[cell] = carvedChart; } return(chartsByCoord); }
static void CopyMarkers(UnityEditor.MenuCommand command) { _copyContext = (ChartStatic)command.context; }