public static SpriteLayer SpriteLayerFromXml(GameResourceManager gameResourceManager, XElement layerElement) { var layerName = layerElement.Attribute("name").Value; var layer = new SpriteLayer(layerName); XmlRepository.BaseFromXml(layer, layerElement); foreach (var element in layerElement.Element("Sprites").Elements()) { var sheetName = element.Attribute("sheetName").Value; var name = element.Attribute("name").Value; var position = element.Attribute("position").Value; var sprite = new Sprite(gameResourceManager.GetSpriteSheet(sheetName), name) { Position = MathUtil.ParseVector(position) }; layer.AddSprite(sprite); } return layer; }