Ejemplo n.º 1
0
 /// <summary>Force a Change in the Level this automatically kill the old level and load the new one.</summary>
 /// <param name="NextLevel">(Abstracted Level) A level to load.</param>
 public void ChangeLevel(cLevel NextLevel)
 {
     _NextLevel = NextLevel;
     ChangeState(LevelState.CallingKill);
 }
Ejemplo n.º 2
0
 public void ReloadLevel()
 {
     _NextLevel = _CurrentLevel;
     ChangeState(LevelState.CallingKill);
 }
Ejemplo n.º 3
0
 /// <summary>Update the Level Management System.</summary>
 public void Update()
 {
     switch (_CurrentState)
     {
         case LevelState.Loading:
             _CurrentLevel = _NextLevel; //<-- Set the Next Level as the Current Level
             _CurrentLevel.Initialize();
             //try
             //{
             //    _CurrentLevel.Initialize(); //<-- Call the Initialize function on the Current Level
             //}
             //catch(Exception e)
             //{
             //    mDebug.Peek.MessagePrompt("Failed to Queue Next Level!" + "\r\n" + e.Message + "\r\n" + e.StackTrace, "Failure!");
             //}
             _NextLevel = null; //<-- Null out the Data on Next Level
             _LevelInitialized = true; //<-- Flag as Initialized
             ChangeState(LevelState.Playing); //Swap States we are ready for play.
             break;
         case LevelState.Killing:
             if (_LevelInitialized) //<-- Determine if we even have data to kill.
             {
                 if (!_LockLevel)
                 {
                     mMenu.Peek.WorkerState = mMenu.MenuState.VOID;
                     _CurrentLevel.Kill(); //<-- Call the Current Level's Kill Command so it can perform it's internal cleanup.
                     _CurrentLevel = null; //<-- Null out the Current Level.
                 }
                 _LevelInitialized = false; //<-- Flag Initialized for false to ensure safety.
                 _LevelOnceUpdated = false;
             }
             ChangeState(LevelState.Loading); //<-- Swap out states
             break;
         case LevelState.Playing:
             if (_LevelInitialized) //<-- Check to see if it's safe to Update the Level
             {
                 mMenu.Peek.WorkerState = mMenu.MenuState.UI;
                 _LevelOnceUpdated = true;
                 _CurrentLevel.Update(); //<-- Call the Level's Update Logic.
             }
             break;
         case LevelState.Paused:
             break;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Assign the Next Level to be Loaded (Try to Execute within the Level's Kill to Safe Memory).
 /// </summary>
 /// <param name="Level">(cLevel) Level to load</param>
 /// <param name="t2dNextLevelTexture">(Texture2D) Texture to use as the Loading Screen CAN BE NULL it will re-use previous texture.</param>
 public void QueueNextLevel(cLevel Level, Texture2D t2dNextLevelTexture)
 {
     if (t2dNextLevelTexture != null)
         _t2dLoading = t2dNextLevelTexture;
     _NextLevel = Level;
 }