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

namespace FredriksdalAssault2
{
    /// <summary>
    /// This class represent a two walls that cross each other.
    /// </summary>
    public class CrossWalls : Building
    {
        #region Instance variables

        // No variables here yet.

        #endregion

        #region Constructors

       /// <summary>
       /// Create a new wall.
       /// </summary>
       /// <param name="position"></param>
       /// <param name="rotation"></param>
       /// <param name="scale"></param>
        public CrossWalls(Vector3 position, Vector3 rotation, float scale)
            : base(position, rotation, scale) 
        {
            // Create bounding boxes for the house.
            CreateBoundingBoxes();
        }

        #endregion

        #region Methods

        /// <summary>
        /// Create bounding boxes for the house.
        /// </summary>
        public override void CreateBoundingBoxes()
        {
            // Create a new list of bounding boxes.
            this.boundingBoxesList = new List<CustomBoundingBox>(3);

            // Create the world matrix used to place bounding boxes in 2D world space.
            Matrix world = this.world;

            // The full wall (must be here because of the first test in the collision method)
            boundingBoxesList.Add(new CustomBoundingBox("structure", new BoundingBox(Vector3.Transform(new Vector3(-150, 0, -150),
                world), Vector3.Transform(new Vector3(150, 140, 150), world))));

            // A wall that goes along the X-axis
            boundingBoxesList.Add(new CustomBoundingBox("wall", new BoundingBox(Vector3.Transform(new Vector3(-150, 0, -10),
                world), Vector3.Transform(new Vector3(150, 140, 10), world))));

            // A wall that goes along the Z-axis
            boundingBoxesList.Add(new CustomBoundingBox("wall", new BoundingBox(Vector3.Transform(new Vector3(-10, 0, -150),
                world), Vector3.Transform(new Vector3(10, 140, 150), world))));


        } // End of the CreateBoundingBoxes method

        /// <summary>
        /// Get a list of cube primitives that represent a wall.
        /// </summary>
        /// <param name="graphicsDevice"></param>
        /// <returns>A list with CubePrimitives</returns>
        public static List<CubePrimitive> CreateCubes(GraphicsDevice graphicsDevice)
        {
            //create a list of cube primitives
            List<CubePrimitive> boxPrimitivesList = new List<CubePrimitive>(2);

            float texCoordScale = 0.6f;

            // Create cube primitives
            boxPrimitivesList.Add(new CubePrimitive(graphicsDevice, new Vector3(-150, 0, -10), new Vector3(150, 140, 10), texCoordScale));
            boxPrimitivesList.Add(new CubePrimitive(graphicsDevice, new Vector3(-10, 0, -150), new Vector3(10, 140, 150), texCoordScale));

            // Return the list with cubes.
            return boxPrimitivesList;

        } // End of the CreateCubes method.

        #endregion

    } // End of class

} // End of class
