public void changeState(State.Type type) { // Unload current state's content currentState.unload(); // Assign new current state currentState = states[type]; // Load next state's content currentState.load(); }
protected override void Initialize() { // Init shape collision dispatching Shape.initialiseCollisionTests(); // Load tracks TrackManager.loadTracks(this); // Camera camera = new Camera(this); // States initialization states = new Dictionary<State.Type, State>(); states[State.Type.MENU] = new MenuState(this); states[State.Type.GAME] = new GameState(this); states[State.Type.VICTORY] = new VictoryState(this); states[State.Type.DEFEAT] = new DefeatState(this); currentState = states[State.Type.MENU]; base.Initialize(); }