public StateHandler() { _score = 0; _gamestate = GameState.Menu; _menustate = MenuState.MainMenu; _levelstate = LevelState.Level1; _transitionstate = TransitionState.LevelStart; _characterstate = CharacterState.Standing; _characterskin = Skins.Mario; _nextgamestate = GameState.Menu; _nextmenustate = MenuState.MainMenu; _nextlevelstate = LevelState.Level1; _nexttransitionstate = TransitionState.LevelStart; _nextcharacterstate = CharacterState.Standing; _nextcharacterskin = Skins.Mario; _cursor = MenuCursor.PlayGame; _keyscursor = 1; _skinscursor = 1; }
/// <summary> /// Switches the current game state. /// </summary> /// <param name="newState">New state.</param> public static void SwitchState(GameState newState) { EndCurrentState(); AddNewState(newState); }
/// <summary> /// Adds a new state to the stack. /// </summary> /// <param name="state">State.</param> public static void AddNewState(GameState state) { _state.Push(state); }
public void ChangeState(GameState next) { _nextgamestate = next; }
public void Run() { _gamestate = _nextgamestate; _menustate = _nextmenustate; _levelstate = _nextlevelstate; _transitionstate = _nexttransitionstate; _characterstate = _nextcharacterstate; _characterskin = _nextcharacterskin; }
/// <summary> /// Move the game to a new state. The current state is maintained /// so that it can be returned to. /// </summary> /// <param name="state">the new game state</param> public static void AddNewState(GameState state) { _state.Push(state); UtilityFunctions.Message = ""; }
/// <summary> /// Move the game to a new state. The current state is maintained /// so that it can be returned to. /// </summary> /// <param name="state">the new game state</param> public static void AddNewState(GameState state) { _state.Push(state); Message = ""; }
/// <summary> /// Adds the state. /// </summary> /// <param name="state">State.</param> public static void AddState(GameState state) { _states.Push (state); }
/// <summary> /// End the current state and add in the new state. /// </summary> /// <param name="newState">the new state of the game</param> public static void SwitchState(GameState newState) { EndCurrentState(); AddNewState(newState); }