/// <summary> /// Changes game state. /// </summary> /// <param name="state">Desired game state.</param> public void ChangeState(GameState state) { _currentState = state; if (state == GameState.Saving) { GameStateManager.CurrentState.Player = GameStateManager.GetPlayerState(_overworld.Players.First()); _savescreen = new SaveScreen(this); } if (state == GameState.LoadGame) { _loadscreen = new LoadScreen(this); } if (state == GameState.NewGame || state == GameState.LoadingGame || state == GameState.DemoMode) { _overworld = null; System.Threading.ThreadPool.QueueUserWorkItem(LoadContentAsync); } }
private void LoadContentAsync(object asyncState) { _overworld = MapLoader.LoadLevels("Content/maps/QuestForTheCrown.maps"); _overworld.Parent = this; }