/// <summary> /// This method will activate the options menu. It should be called after the game has been paused. /// </summary> /// <param name="s">The state to return to once options are completed.</param> /// <param name="pack">see doPacket</param> public void activate(State s, doPacket pack) { activationState = ActivationState.activating; returnState = s; animator = 0; }
/// <summary> /// This method will display an options menu over the current screen during pause. /// </summary> /// <param name="pack">see doPacket</param> public void displayOptions(doPacket pack) { tempState = new OptionsMenuState(); tempState.loadState(this, content); }
/// <summary> /// This method will cease displaying and unload an options menu during pause. This should be called before unpause when an options menu is displayed. /// </summary> /// <param name="pack">see doPacket</param> public void removeOptions(doPacket pack) { tempState.unloadState(content); tempState = null; unpause(pack); }
/// <summary> /// This utility method will load a state using the content manager. /// </summary> /// <param name="newState">The state to be loaded</param> public void loadState(State newState) { this.newState = newState; }
/// <summary> /// This method fires to begin the game. /// </summary> public void initialize() { cameraScale = 1; state = new IntroSplashState(); state.loadState(this, content); }
/// <summary> /// This is the method where the do chain begins. This will call the state's doThis. /// </summary> /// <param name="gameTime">The game time</param> public void doThis(GameTime gameTime) { if (newState != null) { content.Unload(); newState.loadState(this, content); state = newState; newState = null; TextureLoader.ArBonnie = content.Load<SpriteFont>("realassets\\arbonnie"); TextureLoader.CourierNew = content.Load<SpriteFont>("realassets\\couriernew"); TextureLoader.QuartzMS = content.Load<SpriteFont>("realassets\\quartzms"); TextureLoader.RussellSquare = content.Load<SpriteFont>("realassets\\russellsquare"); TextureLoader.SketchFlowPrint = content.Load<SpriteFont>("realassets\\sketchflowprint"); GC.Collect(); //After unloading content, collect the garbage. This will probably be done anyway, but we want to ensure it. } controller.updateController(); //Always update the controller and the time doPack.time = gameTime; if (!paused) //THIS LOGIC NEEDS TO BE REVISED { state.doThis(doPack); } else { tempState.doThis(doPack); } }