Esempio n. 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);
        }
Esempio n. 2
0
        protected override void LoadContent()
        {
            Content          = Game.Content;
            this.spriteBatch = new SpriteBatch(GraphicsDevice);

            // Unless set from outside, load the default font which is shared for all states
            if (this.Font == null)
            {
                this.Font = Content.Load <SpriteFont>(this.fontAsset);
            }
            // TODO: This might be better do somehow else
            if (PauseState != null)
            {
                PauseState.LoadContent();
            }
            base.LoadContent();
        }