public IScenario[] GetScenarios(string scenarioName) { List <IScenario> scenarios = new List <IScenario>(); if (ScenarioMap.ContainsKey(scenarioName)) { IScenario scen = ScenarioMap[scenarioName](); scen.Assembly = this.Assembly; scen.Factory = this.FactoryName; scen.Name = scenarioName; scenarios.Add(scen); } return(scenarios.ToArray()); }
public static Bitmap Generate(ScenarioMap map, Func <AoeTerrainType, Color> palette) { var width = (int)map.width; var height = (int)map.height; var bitmap = new Bitmap(width, height); for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { bitmap.SetPixel(x, height - y - 1, palette(map.terrain[x, y].cnst)); } } return(bitmap); }
public static MapPathingMap Generate(ScenarioMap map) { var w = map.width - 1; var h = map.height - 1; var width = w * 4; var height = h * 4; var pathTiles = new PathingType[height, width]; for (uint x = 0; x < w; x++) { for (uint y = 0; y < h; y++) { var tileType = map.terrain[x, y].cnst; if (!_pathingTypes.TryGetValue(tileType, out var pathingType)) { pathingType = PaddedPathingType; } for (var i = (x == 0 ? 2 : 0); i < (x == w ? 2 : 4); i++) { for (var j = (y == 0 ? 2 : 0); j < (y == h ? 2 : 4); j++) { pathTiles[4 * y + j - 2, 4 * x + i - 2] = pathingType; } } } } var tiles = new PathingType[width * height]; Buffer.BlockCopy(pathTiles, 0, tiles, 0, (int)(width * height) * sizeof(PathingType)); return(new MapPathingMap(MapPathingMapFormatVersion.Normal) { Width = width, Height = height, Cells = tiles.ToList(), }); }
public static MapDoodads Generate(ScenarioMap map, RectangleMargins padding) { var width = (int)map.width; var height = (int)map.height; var doodads = new List <DoodadData>(); var rnd = new Random(); for (uint x = 0; x < width; x++) { for (uint y = 0; y < height; y++) { var tileType = map.terrain[x, y].cnst; if (_treeTypes.TryGetValue(tileType, out var treeType)) { doodads.Add(new DoodadData { TypeId = treeType, Variation = rnd.Next(tileType == AoeTerrainType.PineForest ? 5 : 10), Position = 128f * new Vector3(x - padding.Left, y - padding.Bottom, 0f), Rotation = 0f, Scale = Vector3.One, CreationNumber = doodads.Count, State = DoodadState.Normal, Life = 100, }); } } } // TODO: convert scenario entities to doodads return(new MapDoodads(MapWidgetsFormatVersion.TFT, MapWidgetsSubVersion.V11, false) { Doodads = doodads, }); }
public static Bitmap Generate(ScenarioMap map) { return(Generate(map, (tt) => _colors.TryGetValue(tt, out var color) ? color : Color.Black)); }