Category5.XmlSettingsFile.ReadAnimation C# (CSharp) Метод

ReadAnimation() приватный статический Метод

private static ReadAnimation ( XmlTextReader reader, Microsoft.Xna.Framework.Content.ContentManager content ) : Animation
reader System.Xml.XmlTextReader
content Microsoft.Xna.Framework.Content.ContentManager
Результат Animation
        private static Animation ReadAnimation(XmlTextReader reader, ContentManager content)
        {
            reader.MoveToFirstAttribute();
            string attName;

            //Variables to temporarily store animation parameters
            string texture = null;
            float animTime=0;
            int frameWidth=0;
            int frameHeight=0;

            do{
                attName = reader.Name.ToUpper();
                if(attName == "TEXTURE"){
                    texture = reader.Value;
                }else if(attName == "ANIMTIME"){
                    animTime = float.Parse(reader.Value);
                }
                else if(attName == "FRAMEWIDTH"){
                    frameWidth = int.Parse(reader.Value);
                }
                else if(attName == "FRAMEHEIGHT"){
                    frameHeight = int.Parse(reader.Value);
                }
                else if (attName == "TYPE")
                {
                    //Do Nothng, Animation doesn't need this information
                }
                else
                {
                    throw new ApplicationException("Invalid Animation parameter '" + attName + "' on line " + reader.LineNumber);
                }
            }while(reader.MoveToNextAttribute());

            //Create and return the animation object
            return new Animation(content.Load<Texture2D>(texture), frameWidth, frameHeight, animTime);
        }