Gruppe22.Client.Mainmap.Mainmap C# (CSharp) Method

Mainmap() public method

Create the visible version of the game map
public Mainmap ( Backend parent, SpriteBatch spriteBatch, Microsoft.Xna.Framework.Content.ContentManager content, Rectangle displayArea, Backend map, bool enabled = true ) : System
parent Backend
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch A sprite batch used for drawing
content Microsoft.Xna.Framework.Content.ContentManager
displayArea Microsoft.Xna.Framework.Rectangle The area on wich the map will be placed
map Backend Internal storage of map data
enabled bool
return System
        public Mainmap(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayArea, Backend.Map map, bool enabled = true)
            : base(parent, spriteBatch, content, displayArea)
        {
            _font = _content.Load<SpriteFont>("font");
            _map = map;
            _background = _content.Load<Texture2D>("Minimap");
            _circle = _content.Load<Texture2D>("Light2");
            _highlightedTile = new Backend.Coords(-1, -1);
            _tooltip = new TileTooltip(this, _spriteBatch, _content, _displayRect);
            // Load textures to use in environment
            // 1. Walls and floor
            _walls = new WallTiles(_content, 128, 192, "");
            _floors = new WallTiles(_content, 128, 192, "");

            // 2. Environmental objects (floor, items, traps, teleporters, chest...)
            _environment = new List<TileSet>();
            _environment.Add(new TileSet(_content, 128, 192));
            _environment[0].Load("Content\\misc.xml");
            _environment.Add(new TileSet(_content, 64, 48));
            _environment[1].Load("Content\\Arrow.xml");
            _environment.Add(new TileSet(_content, 55, 55));
            _environment[2].Load("Content\\explosion.xml");

            // 3. Moving entities (player, NPCs, enemies)
            _actors = new List<ActorView>();
            _effects = new List<MapEffect>();

            resetActors();
            _floatnumbers = new List<FloatNumber>();
            _projectiles = new List<Projectile>();
            _enabled = enabled;
        }