MrGravity.LevelInfo.LevelInfo C# (CSharp) Method

LevelInfo() public method

public LevelInfo ( System.Xml.Linq.XElement levelInfo, Microsoft.Xna.Framework.Content.ContentManager content, IControlScheme controls, GraphicsDeviceManager graphics ) : System
levelInfo System.Xml.Linq.XElement
content Microsoft.Xna.Framework.Content.ContentManager
controls IControlScheme
graphics GraphicsDeviceManager
return System
        public LevelInfo(XElement levelInfo, ContentManager content, IControlScheme controls, GraphicsDeviceManager graphics)
        {
            foreach (var element in levelInfo.Elements())
            {
                if (element.Name == XmlKeys.LevelName)
                    Level = new Level(WorldSelect.LevelDirectory + element.Value + ".xml",
                        controls, graphics.GraphicsDevice.Viewport);
                if (element.Name == XmlKeys.Timerstar)
                    TimerStar = Level.TimerStar = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.Collectionstar)
                    CollectStar = Level.CollectionStar = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.Deathstar)
                    DeathStar = Level.DeathStar = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.Goaltime)
                    _mGoalTime = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.Goalcollectable)
                    _mGoalCollectable = Convert.ToInt32(element.Value);

                if (element.Name == XmlKeys.Unlocked)
                    Unlocked = element.Value == XmlKeys.True;
            }
            _mContent = content;
            _mGraphics = graphics;
            _mControls = controls;
        }