public void addObstacle(Obstacle obstacle,int row,int column)
 {
     obstacle.SetValue(Grid.ColumnProperty, column);
     obstacle.SetValue(Grid.RowProperty, row);
     obstacles[row, column] = obstacle;
     Children.Add(obstacle);
 }
        public void loadObstacleLayer(TileLayer tileLayer)
        {
            obstacleLayer = new ObstacleLayer(tileMap.height,tileMap.width,tileMap.tileheight,tileMap.tilewidth);

            for (int i = 0; i < tileLayer.data.Length; i++)
            {
                if (tileLayer.data[i] != 0)
                {
                    int x = i % tileMap.width;
                    int y = i / tileMap.height;

                    Obstacle img = new Obstacle();
                    img.Source = tileImgSrcs[tileLayer.data[i] - 1];
                    obstacleLayer.addObstacle(img,y,x);
                }

            }
        }