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;
using StrategicCombat.Shots;

namespace StrategicCombat.CombatUnits
{
    /// <summary>
    /// This class represents a shooting plane that is positioned on the left side of the board.
    /// </summary>
    public class LeftPlane : LeftCombatUnit
    {
        #region Constructors

        /// <summary>
        /// Create a new plane that is positioned to the left on a board.
        /// </summary>
        /// <param name="content"></param>
        public LeftPlane(ContentManager content, Vector2 position)
            : base(content, position)
        {
            // Load textures.
            this.boardUnitTexture = content.Load<Texture2D>("CombatUnits/LeftCombatUnits/LeftPlane75");
            this.combatUnitTexture = content.Load<Texture2D>("CombatUnits/LeftCombatUnits/LeftPlane50");
            this.shotTexture = content.Load<Texture2D>("Textures/whiteTile");

            // Set movement restriction
            this.movementRestriction = new Vector2(3, 3);

            // Set the movement speed
            this.movementSpeed = 3;

            // Set the shot speed
            this.shotSpeed = 10f;
            this.healthDamage = 13;
            this.shotDelay = 10;
            this.shotDelayCounter = 0;

            // Set delay for movement sound.
            this.movementDelay = 9;
            this.movementDelayCounter = 0;

            // Set the health value.
            this.health = 580;

        }

        #endregion

        #region Methods

        /// <summary>
        /// Add a shot to the list of shots.
        /// </summary>
        public override void AddShot()
        {
            // Add a shot.
            this.shots.Add(new Shot(this.combatPosition + Vector2.Transform(this.combatDirection, Matrix.CreateRotationZ(MathHelper.ToRadians(270))) * 22 - this.combatDirection * 14, this.combatDirection,
                this.shotSpeed, new Point(2, 2), true, 0, false, false));
            this.shots.Add(new Shot(this.combatPosition + this.combatDirection * 26, this.combatDirection,
                this.shotSpeed, new Point(2, 2), true, 0, false, false));
            this.shots.Add(new Shot(this.combatPosition + Vector2.Transform(this.combatDirection, Matrix.CreateRotationZ(MathHelper.ToRadians(90))) * 22 - this.combatDirection * 14, this.combatDirection,
                this.shotSpeed, new Point(2, 2), true, 0, false, false));

        } // End of the AddShot method.

        /// <summary>
        /// Play a movement sound.
        /// </summary>
        public override void PlayMovementSound()
        {
            Program.soundBank.PlayCue("planeMovement");

        } // End of the PlayMovementSound method.

        /// <summary>
        /// Play a shooting sound.
        /// </summary>
        public override void PlayShootingSound()
        {
            Program.soundBank.PlayCue("shooterPlaneShot");

        } // End of the PlayShootingSound method.

        #endregion

    } // End of class

} // End of namespace
