/// <summary>
 /// Initializes the GamePlayScreen with a simulation already built.
 /// </summary>
 /// <param name="sim"></param>
 public GameplayScreen(TopLevelModel topLevel, Simulation sim)
     : base(topLevel)
 {
     base.TransitionOnTime = TimeSpan.FromSeconds(1.5);
       base.TransitionOffTime = TimeSpan.FromSeconds(0.5);
       simulation = sim;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="topLevel"></param>
        /// <param name="completedLevel"></param>
        /// <param name="simulation"></param>
        public CompletionScreen(TopLevelModel topLevel, LevelScoreData completedLevel, Simulation simulation)
            : base(topLevel)
        {
            levelData = completedLevel;
              this.simulation = simulation;

              base.TransitionOnTime = TimeSpan.FromSeconds(0.5);
              base.TransitionOffTime = TimeSpan.FromSeconds(0.5);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="topLevel"></param>
 /// <param name="simulation"></param>
 /// <param name="levelName"></param>
 public PauseMenuScreen(TopLevelModel topLevel, Simulation simulation, string levelName)
     : base(topLevel)
 {
     base.TransitionOnTime = TimeSpan.FromSeconds(0.5);
       base.TransitionOffTime = TimeSpan.FromSeconds(0.5);
       EditorMode = false;
       custom = false;
       this.restartable = simulation;
       LevelName = levelName;
 }
        /// <summary>
        /// Sets up a hard-coded level. This is for testing purposes.
        /// </summary>
        internal Simulation CreateTestLevel()
        {
            Simulation simulation = new Simulation(LevelLoader.Load("Content/Level/" + LevelName.Replace(" ", "") + ".xml", content), content);
              simulation.Background = content.Load<Texture2D>("Texture/GameScreen");

              return simulation;
        }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);

              // Create a new ContentManager so that all level data is flushed
              // from the cache after the level ends.
              if (content == null)
            content = new ContentManager(shared.ServiceProvider, "Content");

              font = shared.Load<SpriteFont>("Font/textfont");
              simulation = new Simulation(level, content);
              // Create the hard-coded level.
              if (simulation == null) {
            simulation = CreateTestLevel();
              }

              //Initialize the bodies in the simulation
              simulation.InitWorld();

              // Set up the level completion event.
              simulation.OnCompletion += OnLevelCompletion;

              // Set up the sounds.
              SetupSoundEvents();

              // once the load has finished, we use ResetElapsedTime to tell the game's
              // timing mechanism that we have just finished a very long frame, and that
              // it should not try to catch up.
              Game.ResetElapsedTime();
        }