//public EditableLevel(ContentManager content) {
        //  _platforms = new List<Platform>();
        //  _treasures = new List<Treasure>();
        //  _deathTraps = new List<DeathTrap>();
        //  _moveablePlatforms = new List<Platform>();
        //  _attempts = 4;
        //  _parTime = 1;
        //  _additionsAllowed = 30;
        //  typesAllowed = "RBHV";
        //  _ballTex = content.Load<Texture2D>("Texture/ball");
        //  Background = content.Load<Texture2D>("Texture/GameScreen");
        //  _custom = true;
        //}
        /// <summary>
        /// Constructs a EditableLevel object.
        /// </summary>
        /// <param name="level">The Level to use to create the simulation.</param>
        /// <param name="content">The ContentManager to use to load the ball texture.</param>
        public EditableLevel(Level level, ContentManager content)
        {
            // TODO: This clones the list, but references the same platforms.
              // If gameplay may modify properties of platforms (or the goal,
              // or the launcher), a deep copy is necessary instead.
              _platforms = new List<Platform>(level.Platforms);
              _treasures = new List<Treasure>(level.Treasures);
              _deathTraps = new List<DeathTrap>(level.DeathTraps);
              _goal = level.Goal;
              _launcher = level.Launcher;
              _moveablePlatforms = new List<Platform>();

              Name = level.Name;

              _attempts = level.Attempts;
              _parTime = level.ParTime;

              //hard coded amount of additions.
              _additionsAllowed = 3;

              Background = content.Load<Texture2D>("Texture/GameScreen");

              typesAllowed = level.AllowedPlatTypes;

              // Load the ball's texture and store it.
              _ballTex = content.Load<Texture2D>("Texture/ball");
              _custom = false;
              // Allow the user to interact with the simulation, and start the timer.
              // _currentState = SimulationState.Active;
        }
 public GameplayScreen(TopLevelModel topLevel, Level level, string levelName)
     : base(topLevel)
 {
     LevelName = levelName;
       this.level = level;
       base.TransitionOnTime = TimeSpan.FromSeconds(1.5);
       base.TransitionOffTime = TimeSpan.FromSeconds(0.5);
 }
        private static Level LoadLevel(XmlDocument doc, ContentManager Content)
        {
            Level level = new Level();

              XmlElement levelNode = (XmlElement)doc.GetElementsByTagName("level")[0];

              level.Name = Convert.ToString(levelNode.Attributes["name"].Value);

              if (levelNode.Attributes["balls"] == null) { // Fall back
            level.Attempts = 3;
            Console.WriteLine("Warning: the number of attempts wasn't specified.");
              } else {
            level.Attempts = Convert.ToInt16(levelNode.Attributes["balls"].Value);
              }

              if (levelNode.Attributes["par-seconds"] == null) { // Fall back
            level.ParTime = 60;
            Console.WriteLine("Warning: the par time wasn't specified.");
              } else {
            level.ParTime = Convert.ToInt16(levelNode.Attributes["par-seconds"].Value);
              }

              if (levelNode.Attributes["toolbox-types"] == null) {
            level.AllowedPlatTypes = "RBHV";
            Console.WriteLine("Warning: the allowed platform types in the editor wasn't specified.");
              } else {
            level.AllowedPlatTypes = Convert.ToString(levelNode.Attributes["toolbox-types"].Value);
              }

              foreach (XmlElement node in doc.GetElementsByTagName("platform")) {
            level.Platforms.Add(LoadPlatform(node, Content));
              }
              foreach (XmlElement node in doc.GetElementsByTagName("treasure")) {
            level.Treasures.Add(LoadTreasure(node, Content));
              }
              foreach (XmlElement node in doc.GetElementsByTagName("deathtrap")) {
            level.DeathTraps.Add(LoadDeathTrap(node, Content));
              }

              level.Launcher = LoadLauncher((XmlElement)doc.GetElementsByTagName("launcher")[0], Content);
              level.Goal = LoadGoal((XmlElement)doc.GetElementsByTagName("goal")[0], Content);

              return level;
        }
 private Level CreateLevel()
 {
     Level level = new Level();
       level.Name = editableLevel.Name;
       level.Goal = editableLevel.Goal;
       level.DeathTraps = editableLevel.DeathTraps;
       level.Treasures = editableLevel.Treasures;
       level.Launcher = editableLevel.Launcher;
       level.Attempts = editableLevel.Attempts;
       level.ParTime = editableLevel.ParTime;
       foreach (Platform platform in editableLevel.Platforms) {
     level.Platforms.Add(platform);
       }
       foreach (Platform platform in editableLevel.MoveablePlatforms) {
     level.Platforms.Add(platform);
       }
       return level;
 }
        /// <summary>
        /// Constructs a Simulation object.
        /// </summary>
        /// <param name="level">The Level to use to create the simulation.</param>
        /// <param name="content">The ContentManager to use to load the ball texture.</param>
        public Simulation(Level level, ContentManager content)
        {
            // TODO: This clones the list, but references the same platforms.
              // If gameplay may modify properties of platforms (or the goal,
              // or the launcher), a deep copy is necessary instead.
              _platforms = new List<Platform>(level.Platforms);
              _treasures = new List<Treasure>(level.Treasures);
              _deathTraps = new List<DeathTrap>(level.DeathTraps);
              _goal = level.Goal;
              _launcher = level.Launcher;
              _moveablePlatforms = new List<Platform>();

              _name = level.Name;

              // Initialize various stats.
              _startingAttempts = level.Attempts;
              _parTime = level.ParTime;
              _attemptsLeft = _startingAttempts;
              _collectedTreasures = 0;
              _bounces = 0;
              //hard coded amount of additions.
              _additionsAllowed = 3;

              Background = content.Load<Texture2D>("Texture/GameScreen");

              // Load the ball's texture and store it.
              _ballTex = content.Load<Texture2D>("Texture/ball");
              // Create the physics simulation.
              //InitWorld();

              // Allow the user to interact with the simulation, and start the timer.
              _currentState = SimulationState.Active;
              _elapsedTime = 0f;
        }