public override void Deserialize(XElement element) { int numRows = 1, numCols = 1; if (element.Element("numRows") != null) { numRows = int.Parse(element.Element("numRows").Value, NumberStyles.Integer, CultureInfo.InvariantCulture); } if (element.Element("numCols") != null) { numCols = int.Parse(element.Element("numCols").Value, NumberStyles.Integer, CultureInfo.InvariantCulture); } spriteSheetRows = numRows; spriteSheetCols = numCols; //Deserialize each IAnimation IEnumerable <XElement> animElems = element.Element("animations").Elements("animation"); foreach (var animElem in animElems) { IAnimation anim = new SpriteAnimation(); anim.Deserialize(animElem); animations.Add(anim.Name, anim); } base.Deserialize(element); }