public void OnLeaveMapClick(DrawableRectangle rectangle) { // This shouldn't be how it operates. I should be able to pop the play and display states off the stack, // but it just restarts the map if I do that. Instead, I have to create a new overworld state, clear the // stack, then push the new state onto the stack in order to avoid the stack eventually overflowing. HaxxitGameState new_state = new ServerOverworldState(); _mediator_manager.Notify("haxxit.engine.state.clear_change", this, new ChangeStateEventArgs(new_state)); }
public override void Update() { // To change a scene, just call one of these: // Mediator.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new OtherGameState())); // Mediator.Notify("haxxit.engine.state.push", this, new ChangeStateEventArgs(new OtherGameState())); // Mediator.Notify("haxxit.engine.state.pop", this, new EventArgs()); // Fixed, you can just check it on each update to see if it worked. --Alex if (System.Environment.TickCount >= departureTime) { if (firstTime == true) { MainStoryState new_state = new MainStoryState(); Mediator.Notify("haxxit.engine.state.clear_change", this, new ChangeStateEventArgs(new_state)); } else if (winner != null && winner.CurrentNode == "Node3") { MainStoryState new_state = new MainStoryState(); Mediator.Notify("haxxit.engine.state.clear_change", this, new ChangeStateEventArgs(new_state)); } else { ServerOverworldState new_state = new ServerOverworldState(); Mediator.Notify("haxxit.engine.state.clear_change", this, new ChangeStateEventArgs(new_state)); } //Mediator.Notify("haxxit.engine.state.pop", this, new ChangeStateEventArgs(new_state)); } }