/// <summary>
        /// This routine looks through the attackers and defenders and determines if there are defenders that need to be added to the mustBeAttackedUnits due to being in the ZOC of a defender being attacked cross river
        /// </summary>
        public static bool CheckIfDefenderToBeAddedDueToCrossRiverAttack(List <GameObject> attackingUnits, List <GameObject> defendingUnits, bool shouldHighlight)
        {
            bool foundUnit = false;
            List <GameObject> adjacentUnits = new List <GameObject>();

            if (attackingUnits.Count > 0)
            {
                // Get all adjacent defenders to the attacking units
                foreach (GameObject attackingUnit in attackingUnits)
                {
                    foreach (GameObject defendingUnit in GameControl.combatRoutinesInstance.GetComponent <CombatRoutines>().ReturnAdjacentEnemyUnits(attackingUnit.GetComponent <UnitDatabaseFields>().occupiedHex, GlobalDefinitions.ReturnOppositeNationality(attackingUnits[0].GetComponent <UnitDatabaseFields>().nationality)))
                    {
                        if (!adjacentUnits.Contains(defendingUnit))
                        {
                            adjacentUnits.Add(defendingUnit);
                        }
                    }
                }

                foreach (GameObject defendingUnit in defendingUnits)
                {
                    if (defendingUnit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                    {
                        //check if the defender is across a river from a committed attacker
                        foreach (GameObject attackingUnit in attackingUnits)
                        {
                            if (attackingUnit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                            {
                                // Go through each of the hexsides on the defending hexes and see if there is a river between the defender and the attacker
                                foreach (HexDefinitions.HexSides hexSide in Enum.GetValues(typeof(HexDefinitions.HexSides)))
                                {
                                    if ((defendingUnit.GetComponent <UnitDatabaseFields>().occupiedHex.GetComponent <HexDatabaseFields>().Neighbors[(int)hexSide] != null) &&
                                        (defendingUnit.GetComponent <UnitDatabaseFields>().occupiedHex.GetComponent <HexDatabaseFields>().Neighbors[(int)hexSide] == attackingUnit.GetComponent <UnitDatabaseFields>().occupiedHex) &&
                                        defendingUnit.GetComponent <UnitDatabaseFields>().occupiedHex.GetComponent <BooleanArrayData>().riverSides[(int)hexSide])
                                    {
                                        // At this point we know that the defender is across the river from a committed attacker

                                        // Now check if there is a friendly unit in the ZOC of the defender and is adjacent to the attacker.  If so, add it to must be attacked

                                        // Get all friendly units that are in the ZOC of the defender
                                        foreach (GameObject unit in ReturnFriendlyUnitsInZOC(defendingUnit))
                                        {
                                            // Now check if any of the units are adjacent to the attacker with a river between them.  If so, add it to must be attacked.
                                            if (adjacentUnits.Contains(unit) &&
                                                GeneralHexRoutines.CheckForRiverBetweenTwoHexes(attackingUnit.GetComponent <UnitDatabaseFields>().occupiedHex, unit.GetComponent <UnitDatabaseFields>().occupiedHex) &&
                                                !unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                                            {
                                                foundUnit = true;
                                                if (shouldHighlight)
                                                {
                                                    GlobalDefinitions.HighlightUnit(unit);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(foundUnit);
        }
        /// <summary>
        /// This routine pulls all the defenders and attackers based on the hex passed and then calls the combat selection GUI
        /// </summary>
        /// <param name="defendingNationality"></param>
        public void PrepForCombatDisplay(GameObject hex, GlobalDefinitions.Nationality defendingNationality)
        {
            // First thing we need to do is check that the combat assignment gui isn't already active.  If it is do not load anoether one.
            if (GameObject.Find("CombatGUIInstance") != null)
            {
                GlobalDefinitions.GuiUpdateStatusMessage("Resolve current combat assignment before assigning another");
                return;
            }

            GameObject singleCombat = new GameObject("prepForCombatDisplay");

            singleCombat.AddComponent <Combat>();
            // Check if the hex has uncommittted units of the right nationality on it and there are adjacent enemies
            if ((hex != null) &&
                (hex.GetComponent <HexDatabaseFields>().occupyingUnit.Count > 0) &&
                (hex.GetComponent <HexDatabaseFields>().occupyingUnit[0].GetComponent <UnitDatabaseFields>().nationality == defendingNationality) &&
                NonCommittedDefendersAvailable(hex) &&
                (ReturnUncommittedUnits(ReturnAdjacentEnemyUnits(hex, GlobalDefinitions.ReturnOppositeNationality(defendingNationality))).Count > 0))
            {
                // Get all the available defending units
                singleCombat.GetComponent <Combat>().defendingUnits = ReturnUncommittedUnits(hex.GetComponent <HexDatabaseFields>().occupyingUnit);

                singleCombat.GetComponent <Combat>().attackingUnits = ReturnUncommittedUnits(ReturnAdjacentEnemyUnits(hex, GlobalDefinitions.ReturnOppositeNationality(defendingNationality)));

                // Fianlly we have to get all potential defenders that are adjacent to the attackers
                foreach (GameObject defender in ReturnUncommittedUnits(ReturnAdjacentDefenders(hex, singleCombat)))
                {
                    if (!singleCombat.GetComponent <Combat>().defendingUnits.Contains(defender))
                    {
                        singleCombat.GetComponent <Combat>().defendingUnits.Add(defender);
                    }
                }

                CallCombatDisplay(singleCombat);
            }
            else
            {
                if (hex == null)
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("No valid hex selected for combat; hex selected must contain enemy units");
                }
                else if (hex.GetComponent <HexDatabaseFields>().occupyingUnit.Count == 0)
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("No units found on hex selected for combat; hex selected must contain enemy units");
                }
                else if (!NonCommittedDefendersAvailable(hex))
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("No uncommitted defenders found on hex selected; all units on hex are already assigned to combat.  Cancel attacks and reassign combat to add additional attacking units.");
                }
                else if (ReturnUncommittedUnits(ReturnAdjacentEnemyUnits(hex, GlobalDefinitions.ReturnOppositeNationality(defendingNationality))).Count == 0)
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("No units are available to attack the hex selected");
                }
                //else if (hex.GetComponent<HexDatabaseFields>().occupyingUnit[0].GetComponent<UnitDatabaseFields>().nationality != defendingNationality)
                else
                {
                    GlobalDefinitions.GuiDisplayUnitsOnHex(hex);
                }

                if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedMovementStateInstance") ||
                    (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanMovementStateInstance"))
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <MovementState>().ExecuteSelectUnit;
                }
                else if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedInvasionStateInstance")
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedInvasionState>().ExecuteSelectUnit;
                }
                else if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedAirborneStateInstance")
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedAirborneState>().ExecuteSelectUnit;
                }
                else
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteSelectUnit;
                }
            }
        }