/// <summary>
 /// Constructs new multiplier from an ObjectData structure and a texture
 /// </summary>
 /// <param name="d">ObjectData structure loaded from an XML file that is loaded from the ContentPipeline</param>
 /// <param name="p">Vector2 representing position</param>
 /// <param name="dir">Vector2 representing the direction the multiplier is moving in</param>
 /// <param name="a">Vector2 representing teh rotation of the multiplier about its origin</param>
 /// <param name="tex">Texture to represent that image</param>
 /// <param name="spawn">Time when the object was spawned</param>
 public Multiplier(PlayerInteractableData d, Vector2 p, Vector2 dir, float a, Texture2D tex, TimeSpan spawn)
     : base(d, tex, spawn)
 {
     position = p;
     direction = dir;
     angle = a;
 }
 /// <summary>
 /// Construct new PlayerInteractable from a PlayerInteractableData structure, a texture to represent this object, and the time at which it spawned.
 /// </summary>
 /// <param name="d">PlayerInteractableData strucutre loaded from an XML file through the ContentPipeline</param>
 /// <param name="tex">Textyre to represent the image</param>
 /// <param name="spawn">Time when the PlayerInteractable spawned</param>
 public PlayerInteractable(PlayerInteractableData d, Texture2D tex, TimeSpan spawn)
     : base(d,tex)
 {
     spawnTime = spawn;
     timeAllowedOnScreen = new TimeSpan(0, 0, 0, 0, d.timeAllowedOnScreen);
     startBlink = new TimeSpan(0, 0, 0, 0, (int)(timeAllowedOnScreen.TotalMilliseconds * 0.55f));
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            graphics.PreferredBackBufferHeight = (graphics.GraphicsDevice.DisplayMode.Height - (graphics.GraphicsDevice.DisplayMode.Height / 9));
            graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width - (graphics.GraphicsDevice.DisplayMode.Width / 7);
            graphics.ApplyChanges();

            #region Textures
            playerBrig = Content.Load<Texture2D>("PlayerImages/Brig2_1");
            playerFrigate = Content.Load<Texture2D>("PlayerImages/Frigate");
            playerManOfWar = Content.Load<Texture2D>("PlayerImages/ManOfWar");
            enemyBrig = Content.Load<Texture2D>("EnemyImages/Brig2_1 - Enemy");
            enemyFireBoat = Content.Load<Texture2D>("EnemyImages/FireBoat");
            enemyFrigate = Content.Load<Texture2D>("EnemyImages/Frigate - Enemy");
            enemyManOfWar = Content.Load<Texture2D>("EnemyImages/ManOfWar - Enemy");
            healthPowerup = Content.Load<Texture2D>("HealthPowerup");
            BossTexture = Content.Load<Texture2D>("EnemyImages/Boss");
            #endregion

            BOSS_POSITION = new Vector2(BossTexture.Width / 2, graphics.PreferredBackBufferHeight / 2 - BossTexture.Height / 2);

            #region Main Menu
            logo = Content.Load<Texture2D>("BeardCoded2_1");
            logoFont = Content.Load<SpriteFont>("Fonts/LogoFont");
            mottoFont = Content.Load<SpriteFont>("Fonts/MottoFont");

            #endregion

            #region GameMaterial
            // Create a new SpriteBatch, which can be used to draw textures.
            // player = new Player_Brig(Content);
            //player = new Player_Frigate(Content);
            playerStartingPos = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2);
            EnemyList = new List<Enemy>();
            spriteBatch = new SpriteBatch(GraphicsDevice);
            playerInteractableList = new List<PlayerInteractable>();
            friendlyList = new List<FriendlyShips>();

            //load player ship textures
            playerCBTexture = Content.Load<Texture2D>("CannonBall");
            enemyCBTexture = Content.Load<Texture2D>("CannonBall_Enemy");
            playerCBPowerUpTexture = Content.Load<Texture2D>("CannonBall_PowerUp");
            //Load HUD
            HUDFont = Content.Load<SpriteFont>("Fonts/HUDFont");
            healthBar = Content.Load<Texture2D>("healthBar");
            multiplierTexture = Content.Load<Texture2D>("Multiplier");
            #endregion

            #region Time Variables
            #endregion

            //Load object data
            #region ObjectData
            PLAYER_BRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_BrigData");
            PLAYER_FRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_FrigateData");
            PLAYER_MOW_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_ManOfWarData");

            FIREBOAT_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/FireboatData");
            ENEMY_BRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_BrigData");
            ENEMY_FRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_FrigateData");
            ENEMY_MOW_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_ManOfWarData");

            FRIENDLY_SHIPS_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/FriendlyShipsData");

            BOSS_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/BossData");

            HEALTH_POWER_DATA = Content.Load<PlayerInteractableData>("ObjectDataFiles/PlayerInteractables/HealthPowerupData");
            MULTIPLIER_DATA = Content.Load<PlayerInteractableData>("ObjectDataFiles/PlayerInteractables/MultiplierData");
            #endregion

            #region Sounds
            //load songs from folder and put in list
            BackgroundSongs = new List<Song>();
            //main menu theme
            mainMenuSong = Content.Load<SoundEffect>("Sounds/PirateWarsMainMenu");
            mainMenuSongInstance = mainMenuSong.CreateInstance();
            mainMenuSongInstance.IsLooped = true;
            //game music
            gameSong = Content.Load<SoundEffect>("Sounds/GIOmetryWars");
            gameSongInstance = gameSong.CreateInstance();
            gameSongInstance.IsLooped = true;
            //game over
            gameOverSong = Content.Load<SoundEffect>("Sounds/GameOver");
            gameOverSongInstance = gameOverSong.CreateInstance();
            #endregion

            #region Menus

            //General buttons
            startButtonPos = new Vector2(300, 300);
            startButton = new GameButton(Content.Load<Texture2D>("StartButton"), startButtonPos);
            returnToMenu = new GameButton(Content.Load<Texture2D>("ReturnToMenu"), new Vector2(250, 325));
            resumeGame = new GameButton(Content.Load<Texture2D>("StartButton"), new Vector2(250, 500));

            //Boot Menu
            TextField motto = new TextField(("Omnis Erigere Niger Vexillum"), new Vector2(200, 600));
            GameButton logoB = new GameButton(logo, new Vector2(graphics.PreferredBackBufferWidth / 2 - logo.Width / 2, graphics.PreferredBackBufferHeight / 2 - logo.Height / 2));
            bootMenu = new Menu(motto, this);
            bootMenu.AddMenuButton(logoB, ToMainMenu);

            //MainMenu
            TextField menuTitle = new TextField(("BOATS BOATS BOATS"), CenterText("BOATS BOATS BOATS", logoFont));
            mainMenu = new Menu(menuTitle, this);
            mainMenu.AddMenuButton(startButton, ToShipSelection);

            //PauseMenu
            TextField pauseTitle = new TextField("PAUSE", CenterText("PAUSE", logoFont));
            pauseMenu = new Menu(pauseTitle, this);
            pauseMenu.AddMenuButton(resumeGame, ToGameOn);
            pauseMenu.AddMenuButton(returnToMenu, ToMainMenu);

            //ShipSelectionMenu
            float x1 = (float)graphics.PreferredBackBufferWidth / 6 - playerBrig.Width / 2;
            float x2 = (x1 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerFrigate.Width / 2);
            float x3 = (x2 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerManOfWar.Width / 2);

            Vector2 ship1Pos = new Vector2(x1, (graphics.PreferredBackBufferHeight / 2) - playerBrig.Height / 2);
            Vector2 ship2Pos = new Vector2(x2, (graphics.PreferredBackBufferHeight / 2) - playerFrigate.Height / 2);
            Vector2 ship3Pos = new Vector2(x3, (graphics.PreferredBackBufferHeight / 2) - playerManOfWar.Height / 2);
            brigButton = new GameButton(playerBrig, ship1Pos);
            frigateButton = new GameButton(playerFrigate, ship2Pos);
            manOfWarButton = new GameButton(playerManOfWar, ship3Pos);

            TextField shipSelectionTitle = new TextField("CHOOSE YOUR SHIP", CenterText("CHOOSE YOUR SHIP", logoFont));
            shipSelectionMenu = new Menu(shipSelectionTitle, this);
            shipSelectionMenu.AddMenuButton(brigButton, LoadPlayerBrig);
            shipSelectionMenu.AddMenuButton(frigateButton, LoadPlayerFrig);
            shipSelectionMenu.AddMenuButton(manOfWarButton, LoadPlayerMOW);
            shipSelectionMenu.AddMenuText(new TextField(PLAYER_BRIG_DATA.PrintData(), new Vector2(brigButton.Position.X, brigButton.Position.Y + brigButton.Texture.Height + 20)));
            shipSelectionMenu.AddMenuText(new TextField(PLAYER_FRIG_DATA.PrintData(), new Vector2(frigateButton.Position.X, frigateButton.Position.Y + brigButton.Texture.Height + 20)));
            shipSelectionMenu.AddMenuText(new TextField(PLAYER_MOW_DATA.PrintData(), new Vector2(manOfWarButton.Position.X, manOfWarButton.Position.Y + brigButton.Texture.Height + 20)));

            #endregion
        }
 /// <summary>
 /// Construct a new health powerup.  Position, direction and angle are all dependent on the main game, but all values from the PlayerInteractableData structure are predetermined.
 /// </summary>
 /// <param name="d">ObjectData structure loaded from an XML file that is loaded from the ContentPipeline</param>
 /// <param name="p">Vector2 representing position</param>
 /// <param name="dir">Vector2 representing the direction the multiplier is moving in</param>
 /// <param name="a">Vector2 representing teh rotation of the multiplier about its origin</param>
 /// <param name="tex">Texture to represent that image</param>
 /// <param name="spawn">Time when the object was spawned</param>
 public HealthPowerup(PlayerInteractableData d, Vector2 p, Vector2 dir, float a, Texture2D tex, TimeSpan spawn)
     : base(d, p, dir, a, tex,spawn)
 {
     /*same constructor as Multiplier*/
 }