private void onStateChange()
    {
        StateEpisode stateEpisode = getStateEpisodeForState(this.state);
        StateEpisode lastEpisode = this.eventWrapper.setStateEpisode(stateEpisode);
        if (lastEpisode != null)
        	lastEpisode.cleanup();
        
        if (stateEpisode != null)
            stateEpisode.start();
    }
private void onStateChange ( ) { StateEpisode stateEpisode = getStateEpisodeForState ( this . state ) ; StateEpisode lastEpisode = this . eventWrapper . setStateEpisode ( stateEpisode ) ; if ( lastEpisode != null ) lastEpisode . cleanup ( ) ; if ( stateEpisode != null ) stateEpisode . start ( ) ; }
For each state change, kick off the next required action.<br>
This was implemented initially to allow us to handle the loading of maps in multiple stages,<br>
giving Minecraft a chance to respond in between each stage. This theoretically minimises race conditions etc.<br>
For each new state, we create a MissionStateEpisode, which contains all the code relating to that event:<br>
what action to take, how to tell when the state can move on, and what state it should move on into.