private void PlaceTileMapping(int x, int y, int tileSetId, int tileId) { var tileCoordinate = new TileCoordinate(x, y, tileSetId, tileId); if (CoordinateMap.Contains(tileCoordinate)) { var index = CoordinateMap.IndexOf(tileCoordinate); CoordinateMap[index] = tileCoordinate; } else { CoordinateMap.Add(tileCoordinate); } }
private void PopulateMap(char marker = '#') { if (CoordinateMap.Any()) { CoordinateMap = new List <Point>(); } string[] rows = _rawInput.Split(new[] { Environment.NewLine }, StringSplitOptions.None); mapSizeX = rows[0].Length; mapSizeY = rows.Length; for (int y = 0; y < mapSizeY; y++) { for (int x = 0; x < mapSizeX; x++) { if (rows[y][x] == marker) { CoordinateMap.Add(new Point(x, y)); } } } }