public void Resume() { //Devemos carregar um novo nível? if(_loadNewLevel) StageManager.Instance.LoadNextMap(); //Se temos mais de um mapa carregado: if (StageManager.Instance.QtdLoadedMaps > 0) { _currentMap = new Map(StageManager.Instance.CurrentMap, _game); } //Nome do MApa: _stageTitle = new Label(StageManager.Instance.CurrentMap._mapName, new Vector2(_game.GraphicsDevice.Viewport.Width / 2, _game.GraphicsDevice.Viewport.Height / 10), _mediumFont); //Criando o Player: _player = new Player(_game, _currentMap.SpawnTile); //Focando a câmera no Player: _game.Components.Add(_camera); _camera.Focus = _player; _background = new Background(_game, 30, false); //Gravando o mapa que paramos: var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values["CURRENT_MAP"] = StageManager.Instance.CurrentMap._mapId; //Reiniciando o timer: _loadNewLevel = false; _stateChangeTimer = TimeSpan.Zero; _gameRunning = true; }
public bool Init(MainGame game, StateMachine stateMachine) { //Salvando os valores: _game = game; _stateMachine = stateMachine; _loadNewLevel = false; _gameRunning = true; _stateChangeTimer = TimeSpan.Zero; //Carregando os recursos: _mediumFont = _game.Content.Load<SpriteFont>("Fonts/QuestrianMedium"); //Se temos mais de um mapa carregado: if (StageManager.Instance.QtdLoadedMaps > 0) { _currentMap = new Map(StageManager.Instance.CurrentMap, _game); } //Criando o Player: _player = new Player(game, _currentMap.SpawnTile); //Criando a Câmera: _camera = new Camera2D(game); game.Components.Add(_camera); _camera.Focus = _player; //Criando o titulo do mapa: _stageTitle = new Label(StageManager.Instance.CurrentMap._mapName, new Vector2(_game.GraphicsDevice.Viewport.Width / 2, _game.GraphicsDevice.Viewport.Height / 10), _mediumFont); //Criando o background: _background = new Background(_game, 30, false); //Tudo correu bem: return true; }
public bool Init(MainGame game, StateMachine stateMachine) { //Salvando os valores: _game = game; _stateMachine = stateMachine; //Carregando os recursos de Linguagem: var languadeLoader = new Windows.ApplicationModel.Resources.ResourceLoader(); //Carregando os recursos: _menuFont = _game.Content.Load<SpriteFont>("Fonts/QuestrianMedium"); _titleFont = _game.Content.Load<SpriteFont>("Fonts/KL1MonoCase"); //Criando o Título: _title = new Label("Blocky", new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height / 8), _titleFont); //Criando os botões: _buttons = new Label[4]; _buttons[0] = new Label(languadeLoader.GetString("PlayMenuOption"), new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height - (game.GraphicsDevice.Viewport.Height * 0.65f)), _menuFont); _buttons[1] = new Label(languadeLoader.GetString("HighScoresMenuOption"), new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height - (game.GraphicsDevice.Viewport.Height * 0.5f)), _menuFont); _buttons[2] = new Label(languadeLoader.GetString("OptionsMenuOption"), new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height - (game.GraphicsDevice.Viewport.Height * 0.35f)), _menuFont); _buttons[3] = new Label(languadeLoader.GetString("ExitMenuOption"), new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height - (game.GraphicsDevice.Viewport.Height * 0.2f)), _menuFont); //Criando o efeito de background: _background = new Background(_game, 60, true); //Tudo correu bem: return true; }