internal static void BuildButtonFunction()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     HeroActionGroupState = HeroActionButtonGroupState.BUILD_PAGE_ONE;
 }
 internal static void BuyWolfPenButtonFunction()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     if (mHero.HeroAttribute.Gold >= GameController.StructurePool[6][0].StructureAttribute.Cost && mHero.HeroAttribute.OwnedWolfPens < 6)
     {
         mHero.HeroAttribute.OwnedWolfPens++;
         mHero.HeroAttribute.Gold -= GameController.StructurePool[6][0].StructureAttribute.Cost;
         HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;
     }
 }
 internal static void BackButtonFunction()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;
     SelectedStructureType = ObjectType.NULL;
     RallyTargetState = RallyFetchTarget.INACTIVE;
 }
        internal static void BlueStructureButtonFunction()
        {
            AudioController.BuildingSpawnSoundEffectInstance.Play();
            // Blue   index = 0
            if (SelectedStructureType != ObjectType.NULL && BlueOccupationState != StructureOccupationState.OCCUPIED)
            {
                GameController.InPlayStructures[0] = GameController.StructurePool[(int)SelectedStructureType][0];
                GameController.InPlayStructures[0].Sprite.WorldPosition = BlueStructureButton.Position;
                GameController.InPlayStructures[0].SetObjectID();

                GameObject.mPotentialTargetListList.InsertLast(GameController.InPlayStructures[0]);
                GameObject.mInPlayObjectList.InsertLast(GameController.InPlayStructures[0]);
                GameObject.mPotentialTargetListList.Reset();
                HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;
                SelectedStructureType = ObjectType.NULL;
                BlueOccupationState = StructureOccupationState.OCCUPIED;

            }
        }
        // Updates positions and states for each button group/menu/button.
        internal static void UpdateUIActiveState(GameTime gameTime)
        {
            if (FriendlyAttribute.BattleCrySpellState == BattleCrySpellState.ACTIVE && HeroAttribute.BattleCrySpellState == BattleCrySpellState.ACTIVE)
            {
                battleCryTimer += gameTime.ElapsedGameTime.Milliseconds;

                if (battleCryTimer >= mHero.HeroAttribute.CalculateSpellTimer())
                {
                    FriendlyAttribute.BattleCrySpellState = BattleCrySpellState.INACTIVE;
                    HeroAttribute.BattleCrySpellState = BattleCrySpellState.INACTIVE;
                    battleCryTimer = 0;
                }
                HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;
            }

            if (EnemyAttribute.IntimidateSpellState == IntimidateSpellState.ACTIVE && HeroAttribute.IntimidateSpellState == IntimidateSpellState.ACTIVE)
            {
                curseTimer += gameTime.ElapsedGameTime.Milliseconds;

                if (curseTimer >= mHero.HeroAttribute.CalculateSpellTimer())
                {
                    HeroAttribute.IntimidateSpellState = IntimidateSpellState.INACTIVE;
                    EnemyAttribute.IntimidateSpellState = IntimidateSpellState.INACTIVE;
                    curseTimer = 0;
                }
                HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;
            }
            mouseState = Mouse.GetState();
            UpdateMouse(gameTime);

            BottomMenuWindow.Update(gameTime);
            UtilityButtonGroup.Update(gameTime);
            SettingsButtonGroup.Update(gameTime);
            StatusWindow.Update(gameTime);
            TopMenuBar.Update(gameTime);
            mHealthGlobeLiquid.UpdateHp();
            mManaGlobeLiquid.UpdateMana();
            ListenMouseClicks(gameTime);
            ListenMouseover(gameTime);

            if (HeroActionGroupState == HeroActionButtonGroupState.HERO_ACTION)
            {

                HeroActionButtonGroup.Update(gameTime);
            }

            if (HeroActionGroupState == HeroActionButtonGroupState.BUILD_PAGE_ONE)
            {
                BuildButtonGroup.Update(gameTime);
                StructureButtonGroup.Update(gameTime);
            }

            if (HeroActionGroupState == HeroActionButtonGroupState.BUILD_PAGE_TWO)
            {
                BuildButtonGroupPageTwo.Update(gameTime);
                StructureButtonGroup.Update(gameTime);
            }

            if (HeroActionGroupState == HeroActionButtonGroupState.RALLY)
            {
                RallyButtonGroup.Update(gameTime);
                StructureButtonGroup.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.PURCHASE_PAGE_ONE)
            {
                PurchaseStructureButtonGroup.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.PURCHASE_PAGE_TWO)
            {
                PurchaseStrctureButtonGroupPageTwo.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.UPGRADE_ONE)
            {
                UpgradeUnitButtonGroup1.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.UPGRADE_TWO)
            {
                UpgradeUnitButtonGroup2.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.UPGRADE_THREE)
            {
                UpgradeUnitButtonGroup3.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.UPGRADE_FOUR)
            {
                UpgradeUnitButtonGroup4.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.UPGRADE_FIVE)
            {
                UpgradeUnitButtonGroup5.Update(gameTime);
            }
            if (HeroActionGroupState == HeroActionButtonGroupState.SPELLS)
            {
                SpellButtonGroup.Update(gameTime);
            }

            UpdateDisabledButtons();
        }
        internal static void UpgradeDefenseButtonFunction5()
        {
            if (GameController.InPlayStructures[4] != null && GameController.InPlayStructures[4].StructureAttribute.UpgradeDefenseCost < mHero.HeroAttribute.Gold)
            {

                AudioController.ButtonClick3SoundEffectInstance.Play();
                GameObject.mPotentialTargetListList.Reset();
                for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++)
                {
                    if (GameObject.mPotentialTargetListList.GetCurrent().gameObject is Friendly)
                    {
                        if (tempFriendly.CreatureType ==
                            GameObject.mPotentialTargetListList.GetCurrent().gameObject.CreatureType)
                        {
                            Friendly temp = (Friendly)GameObject.mPotentialTargetListList.GetCurrent().gameObject;
                            temp.FriendlyAttribute.UpgradeDefense();
                        }
                    }

                    GameObject.mPotentialTargetListList.NextNode();
                }

                GameController.InPlayStructures[4].StructureAttribute.DefenseLevel++;

                switch (tempFriendly.CreatureType)
                {

                    case ObjectType.DRAGON:
                        GameController.FriendlyPool[7].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.NECROMANCER:
                        GameController.FriendlyPool[5].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.ARCANE_MAGE:
                        GameController.FriendlyPool[2].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.FIRE_MAGE:
                        GameController.FriendlyPool[6].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.WOLF:
                        GameController.FriendlyPool[0].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.AXE_THROWER:
                        GameController.FriendlyPool[3].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.BERSERKER:
                        GameController.FriendlyPool[1].FriendlyAttribute.UpgradeDefense();
                        break;
                    case ObjectType.CLERIC:
                        GameController.FriendlyPool[4].FriendlyAttribute.UpgradeDefense();
                        break;

                    default:
                        Console.WriteLine("Upgrade Attack incorrect case");
                        break;
                }
                mHero.HeroAttribute.Gold -= GameController.InPlayStructures[4].StructureAttribute.UpgradeDefenseCost;
                HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;

            }
        }
 internal static void RallyButtonFunction()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     HeroActionGroupState = HeroActionButtonGroupState.RALLY;
 }
 internal static void SpellButtonFunction()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     HeroActionGroupState = HeroActionButtonGroupState.SPELLS;
 }
 internal static void PurchaseStructureButtonFunction()
 {
     AudioController.ButtonClick3SoundEffectInstance.Play();
     HeroActionGroupState = HeroActionButtonGroupState.PURCHASE_PAGE_ONE;
 }
        internal static void NextButtonFunction()
        {
            AudioController.ButtonClick3SoundEffectInstance.Play();
            switch (HeroActionGroupState)
            {
                case HeroActionButtonGroupState.PURCHASE_PAGE_ONE:
                    HeroActionGroupState = HeroActionButtonGroupState.PURCHASE_PAGE_TWO;
                    break;

                case HeroActionButtonGroupState.PURCHASE_PAGE_TWO:
                    HeroActionGroupState = HeroActionButtonGroupState.PURCHASE_PAGE_ONE;
                    break;

                case HeroActionButtonGroupState.BUILD_PAGE_ONE:
                    HeroActionGroupState = HeroActionButtonGroupState.BUILD_PAGE_TWO;
                    break;

                case HeroActionButtonGroupState.BUILD_PAGE_TWO:
                    HeroActionGroupState = HeroActionButtonGroupState.BUILD_PAGE_ONE;
                    break;

                default:
                    break;
            }
        }
        // Load the Content for each object.
        internal static void LoadUserInterface(GameTime gametime, ContentManager contentManager, SpriteBatch spritebatch)
        {
            // Set up Dependant Variables
            gameTime = gametime;
            Content = contentManager;
            spriteBatch = spritebatch;

            InitializeMouseTextures();
            InitializeWindows();
            InitializeMenus();
            InitializeButtonGroups();
            InitializeButtons();
            InitializeSpriteFonts();
            InitializeGlobes();

            LoadMenus();
            LoadWindows();
            LoadButtonGroups();
            LoadGlobes();

            HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;
        }
        internal static void ListenForUpgrade()
        {
            for (int i = 0; i < StructureButtonGroup.ButtonList.Count; i++)
            {
                if (StructureButtonGroup.ButtonList[i].ButtonRectangle.Contains(mouseRectangle))
                {

                    if (StructureButtonGroup.ButtonList[i] == BlueStructureButton &&
                        BlueOccupationState == StructureOccupationState.OCCUPIED)
                    {
                        tempStructure = (Structure)GameObject.mInPlayObjectList.GetCurrent().gameObject;
                        HeroActionGroupState = HeroActionButtonGroupState.UPGRADE_ONE;
                        break;
                    }
                    if (StructureButtonGroup.ButtonList[i] == RedStructureButton &&
                        RedOccupationState == StructureOccupationState.OCCUPIED)
                    {
                        tempStructure = (Structure)GameObject.mInPlayObjectList.GetCurrent().gameObject;
                        HeroActionGroupState = HeroActionButtonGroupState.UPGRADE_TWO;
                        break;
                    }
                    if (StructureButtonGroup.ButtonList[i] == YellowStructureButton &&
                        YellowOccupationState == StructureOccupationState.OCCUPIED)
                    {
                        tempStructure = (Structure)GameObject.mInPlayObjectList.GetCurrent().gameObject;
                        HeroActionGroupState = HeroActionButtonGroupState.UPGRADE_THREE;
                        break;
                    }
                    if (StructureButtonGroup.ButtonList[i] == GreenStructureButton &&
                        GreenOccupationState == StructureOccupationState.OCCUPIED)
                    {
                        tempStructure = (Structure)GameObject.mInPlayObjectList.GetCurrent().gameObject;
                        HeroActionGroupState = HeroActionButtonGroupState.UPGRADE_FOUR;
                        break;
                    }
                    if (StructureButtonGroup.ButtonList[i] == PurpleStructureButton &&
                        PurpleOccupationState == StructureOccupationState.OCCUPIED)
                    {
                        tempStructure = (Structure)GameObject.mInPlayObjectList.GetCurrent().gameObject;
                        HeroActionGroupState = HeroActionButtonGroupState.UPGRADE_FIVE;
                        break;
                    }
                }
            }
        }
        internal static void ListenForRallyPoint()
        {
            if (RallyTargetState == RallyFetchTarget.ACTIVE && GameController.PlayingField.Contains(mouseRectangle))
            {

                switch (objectColor)
                {
                    case ObjectColor.BLUE:

                        GameObject.mPotentialTargetListList.Reset();
                        for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++)
                        {

                            if (GameObject.mPotentialTargetListList.GetCurrent().gameObject.Hostility == Hostility.FRIENDLY &&
                                !(GameObject.mPotentialTargetListList.GetCurrent().gameObject is Hero))
                            {
                                Friendly temp = (Friendly)GameObject.mPotentialTargetListList.GetCurrent().gameObject;

                                if (temp.Color == ObjectColor.BLUE)
                                {

                                    temp.DefaultTarget = new Vector2(mouseState.X, mouseState.Y);
                                }
                            }

                            GameObject.mPotentialTargetListList.NextNode();
                        }
                        if (GameController.InPlayStructures[0] != null)
                            GameController.InPlayStructures[0].StructureAttribute.DefaultUnitTarget = new Vector2(mouseState.X, mouseState.Y);
                        break;

                    case ObjectColor.GREEN:

                        GameObject.mPotentialTargetListList.Reset();
                        for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++)
                        {
                            if (GameObject.mPotentialTargetListList.GetCurrent().gameObject.Hostility == Hostility.FRIENDLY &&
                                !(GameObject.mPotentialTargetListList.GetCurrent().gameObject is Hero))
                            {
                                Friendly temp = (Friendly)GameObject.mPotentialTargetListList.GetCurrent().gameObject;

                                if (temp.Color == ObjectColor.GREEN)
                                {
                                    temp.DefaultTarget = new Vector2(mouseState.X, mouseState.Y);
                                }
                            }
                            GameObject.mPotentialTargetListList.NextNode();
                        }
                        if (GameController.InPlayStructures[3] != null)
                            GameController.InPlayStructures[3].StructureAttribute.DefaultUnitTarget = new Vector2(mouseState.X, mouseState.Y);

                        break;

                    case ObjectColor.PURPLE:

                        GameObject.mPotentialTargetListList.Reset();
                        for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++)
                        {
                            if (GameObject.mPotentialTargetListList.GetCurrent().gameObject.Hostility == Hostility.FRIENDLY &&
                                !(GameObject.mPotentialTargetListList.GetCurrent().gameObject is Hero))
                            {
                                Friendly temp = (Friendly)GameObject.mPotentialTargetListList.GetCurrent().gameObject;

                                if (temp.Color == ObjectColor.PURPLE)
                                {
                                    temp.DefaultTarget = new Vector2(mouseState.X, mouseState.Y);
                                }
                            }
                            GameObject.mPotentialTargetListList.NextNode();
                        }
                        if (GameController.InPlayStructures[4] != null)
                            GameController.InPlayStructures[4].StructureAttribute.DefaultUnitTarget = new Vector2(mouseState.X, mouseState.Y);

                        break;

                    case ObjectColor.RED:

                        GameObject.mPotentialTargetListList.Reset();
                        for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++)
                        {
                            if (GameObject.mPotentialTargetListList.GetCurrent().gameObject.Hostility == Hostility.FRIENDLY &&
                                !(GameObject.mPotentialTargetListList.GetCurrent().gameObject is Hero))
                            {
                                Friendly temp = (Friendly)GameObject.mPotentialTargetListList.GetCurrent().gameObject;

                                if (temp.Color == ObjectColor.RED)
                                {
                                    temp.DefaultTarget = new Vector2(mouseState.X, mouseState.Y);
                                }
                            }
                            GameObject.mPotentialTargetListList.NextNode();
                        }
                        if (GameController.InPlayStructures[1] != null)
                            GameController.InPlayStructures[1].StructureAttribute.DefaultUnitTarget = new Vector2(mouseState.X, mouseState.Y);

                        break;

                    case ObjectColor.YELLOW:

                        GameObject.mPotentialTargetListList.Reset();
                        for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++)
                        {
                            if (GameObject.mPotentialTargetListList.GetCurrent().gameObject.Hostility == Hostility.FRIENDLY &&
                                !(GameObject.mPotentialTargetListList.GetCurrent().gameObject is Hero))
                            {
                                Friendly temp = (Friendly)GameObject.mPotentialTargetListList.GetCurrent().gameObject;

                                if (temp.Color == ObjectColor.YELLOW)
                                {
                                    temp.DefaultTarget = new Vector2(mouseState.X, mouseState.Y);
                                }
                            }
                            GameObject.mPotentialTargetListList.NextNode();
                        }
                        if (GameController.InPlayStructures[2] != null)
                            GameController.InPlayStructures[2].StructureAttribute.DefaultUnitTarget = new Vector2(mouseState.X, mouseState.Y);

                        break;

                    default:
                        break;
                }

                RallyTargetState = RallyFetchTarget.INACTIVE;
                objectColor = ObjectColor.NULL;
                HeroActionGroupState = HeroActionButtonGroupState.HERO_ACTION;

            }
        }