示例#1
0
 public void ChangeState(string newState)
 {
     if (newState == "MainMenu")
     {
         currentState = new MainMenuState();
     }
     else if (newState == "Start" || newState == "Load")
     {
         currentState = new PlayGameState();
     }
     else if (newState == "Options")
     {
         currentState = new OptionsState();
     }
     else if (newState == "Credits")
     {
         currentState = new CreditsState();
     }
     else if (newState == "Exit")
     {
         currentState = new ExitState();
     }
     else
     {
         throw new NotSupportedException("State change to " + newState + " is not supported yet!");
     }
     currentState.Start();
 }
示例#2
0
 public static void SetMenuState(string NextState)
 {
     MenuState.End();
     MenuState = MenuStateList[NextState];
     MenuState.Start();
 }