public void goToPauseState() { States.State temp = currentState; currentState = new States.PauseMenu(this, Keyboard.GetState(), GamePad.GetState(PlayerIndex.One), "", temp); currentState.Initialize(); currentState.LoadContent(); }
public PauseMenu(Game1 _game, KeyboardState _oldKeyboardState, GamePadState _oldGamePadState, string lastsavename, State lastState) : base(_game, _oldKeyboardState, _oldGamePadState) { this.lastState = lastState; this.oldComponents = new IGameComponent[_game.Components.Count]; for (int i = _game.Components.Count - 1; i >= 0; i--) { this.oldComponents[i] = _game.Components[i]; _game.Components.RemoveAt(i); } this.lastsavename = lastsavename; }
public override void Initialize() { switch (level) { case 0: state = new CinematicState(Game, loadname); break; case 1: state = new LevelZero(Game, loadname); break; case 2: state = new LevelOne(Game, loadname); break; case 3: state = new LevelTwo(Game, loadname); break; case 4: state = new LevelThree(Game, loadname); break; default: break; } }
public void goToNextState(States.State state) { for (int i = this.Components.Count - 1; i >= 0; i--) { if (this.Components[i] is GameComponent) { GameComponent temp = (GameComponent)this.Components[i]; temp.Dispose(); } } currentState = state; currentState.Initialize(); currentState.LoadContent(); }
public void goToBackFromPauseState(States.State previousState) { States.State tempState = previousState; currentState = tempState; }