using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace StrategicCombat.Maps
{
    /// <summary>
    /// This class represent a combat scene.
    /// </summary>
    public abstract class CombatScene
    {
        #region Variables

        public Rectangle combatSceneRectangle;
        public Texture2D blankTexture;
        public Texture2D combatSceneTexture;
        
        // List of barriers
        public Rectangle[] barriers;
        public Texture2D barrierTexture;

        #endregion

        #region Constructors

        /// <summary>
        /// Create a new combat scene.
        /// </summary>
        /// <param name="content"></param>
        public CombatScene(ContentManager content)
        {
            // Load the textures
            this.blankTexture = content.Load<Texture2D>("Textures/whiteTile");

            // Create the combat scene rectangle.
            this.combatSceneRectangle = new Rectangle(240, 72, 800, 576);

        }

        #endregion

        #region Methods

        /// <summary>
        /// Draw the combat scene, must be called inside spritebatch.begin() and spritebatch.end()
        /// </summary>
        public virtual void Draw(SpriteBatch spriteBatch)
        {

            // Draw a black frame
            spriteBatch.Draw(this.blankTexture, new Vector2(this.combatSceneRectangle.X - 2, this.combatSceneRectangle.Y - 2), new Rectangle(0, 0, 800 + 4, 576 + 4), Color.Black, 0, Vector2.Zero, 1, SpriteEffects.None, 0);

            // Draw the scene.
            spriteBatch.Draw(this.combatSceneTexture, this.combatSceneRectangle, Color.White);

            // Draw barriers.
            for (int i = 0; i < this.barriers.Length; i++)
            {
                spriteBatch.Draw(this.barrierTexture, this.barriers[i], new Rectangle(0,0, this.barriers[i].Width, this.barriers[i].Height), Color.White);
            }

        } // End of the Draw method

        #endregion

    } // End of class

} // End of namespace
