Exemple #1
0
        public override void LoadContent()
        {
            int width       = Map.TileWidth;
            int height      = Map.TileHeight;
            var gridTexture = new Texture2D(_graphics.GraphicsDevice, width, height);

            gridTexture.SetData(Helpers.GetBorder(width, height, 1, Color.Black));

            _grids = new List <Sprite>();

            int tileXCount = _gameModel.ScreenWidth / width;
            int tileYCount = _gameModel.ScreenHeight / height;

            for (int y = 0; y < tileYCount; y++)
            {
                for (int x = 0; x < tileXCount; x++)
                {
                    var position = new Vector2((x * width) - (width / 2), y * height - (height / 2));

                    _grids.Add(new Sprite(gridTexture)
                    {
                        Position = position
                    });
                }
            }

            _map = new Map(tileXCount, tileYCount + 1);

            _player = new Entities.Roaming.Player(_content.Load <Texture2D>("Roaming/Player"), _map)
            {
                Position = new Vector2(240, 440),
            };

            _afterBattleState = new AfterBattleState(_gameModel, _players);
            _afterBattleState.LoadContent();

            _pauseState = new PauseState(_gameModel, _players);
            _pauseState.LoadContent();

            _mapState = new MapState(_gameModel, _players);
            _mapState.LoadContent();

            SetAreas();

            LoadArea(_areas.FirstOrDefault());

            _transition = new FourCornersTransition(_gameModel);
        }