private AdjacencyMatrix <LayerTile> GetAdjacencyMatrixFromTiledMapLayer(TiledMapLayer tiledMapLayer, IDictionary <int, int> weights) { var result = new AdjacencyMatrix <LayerTile>(); foreach (var tile in tiledMapLayer.Tiles) { if (weights.ContainsKey(tile.Id)) { foreach (var neighbour in tiledMapLayer.GetNeighboursFromTile(tile)) { if (neighbour != null && weights.ContainsKey(neighbour.Id)) { result.AddAdjacent(tile, neighbour, weights[neighbour.Id]); } } } } return(result); }
private AdjacencyMatrix<LayerTile> GetAdjacencyMatrixFromTiledMapLayer(TiledMapLayer tiledMapLayer, IDictionary<int, int> weights) { var result = new AdjacencyMatrix<LayerTile>(); foreach (var tile in tiledMapLayer.Tiles) { if (weights.ContainsKey(tile.Id)) { foreach (var neighbour in tiledMapLayer.GetNeighboursFromTile(tile)) { if (neighbour != null && weights.ContainsKey(neighbour.Id)) { result.AddAdjacent(tile, neighbour, weights[neighbour.Id]); } } } } return result; }