コード例 #1
0
        private void YesContinue()
        {
            for (int index = 0; index < singleCombat.GetComponent <Combat>().attackingUnits.Count; index++)
            {
                GlobalDefinitions.MoveUnitToDeadPile(singleCombat.GetComponent <Combat>().attackingUnits[index]);
            }

            foreach (GameObject unit in singleCombat.GetComponent <Combat>().defendingUnits)
            {
                if (unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                {
                    unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = false;
                    GlobalDefinitions.HighlightUnit(unit);
                }
            }

            Destroy(singleCombat);
            GUIRoutines.RemoveGUI(GlobalDefinitions.combatGUIInstance);

            if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance"))
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteSelectUnit;
            }
            else
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <MovementState>().ExecuteSelectUnit;
            }
        }
コード例 #2
0
 public void ExecutePostCombatMovement()
 {
     GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.POSTCOMBATOKKEYWORD + " " + name);
     GUIRoutines.RemoveGUI(transform.parent.gameObject);
     GlobalDefinitions.hexesAvailableForPostCombatMovement.Clear();
     GlobalDefinitions.combatResolutionGUIInstance.SetActive(true);
 }
コード例 #3
0
        private void NoAbort()
        {
            foreach (GameObject unit in singleCombat.GetComponent <Combat>().defendingUnits)
            {
                if (unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                {
                    unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = false;
                }
            }

            foreach (GameObject unit in singleCombat.GetComponent <Combat>().attackingUnits)
            {
                if (unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                {
                    unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = false;
                }
            }

            Destroy(singleCombat);
            GUIRoutines.RemoveGUI(GlobalDefinitions.combatGUIInstance);

            if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance"))
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteSelectUnit;
                CombatRoutines.CheckIfRequiredUnitsAreUncommitted(GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality, true);
            }
            else
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <MovementState>().ExecuteSelectUnit;
                CombatRoutines.CheckIfRequiredUnitsAreUncommitted(GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality, false);
            }
        }
コード例 #4
0
        public void InvadedAreaSelected()
        {
            if (GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.INVASIONAREASELECTIONKEYWORD + " " + name);
                GameControl.invasionRoutinesInstance.GetComponent <InvasionRoutines>().SetInvasionArea(index);

                // Turn on the gui buttons

                GlobalDefinitions.nextPhaseButton.GetComponent <Button>().interactable           = true;
                GlobalDefinitions.undoButton.GetComponent <Button>().interactable                = true;
                GlobalDefinitions.MustAttackToggle.GetComponent <Toggle>().interactable          = true;
                GlobalDefinitions.AssignCombatButton.GetComponent <Button>().interactable        = true;
                GlobalDefinitions.DisplayAllCombatsButton.GetComponent <Button>().interactable   = true;
                GlobalDefinitions.AlliedSupplyRangeToggle.GetComponent <Toggle>().interactable   = true;
                GlobalDefinitions.GermanSupplyRangeToggle.GetComponent <Toggle>().interactable   = true;
                GlobalDefinitions.AlliedSupplySourcesButton.GetComponent <Button>().interactable = true;

                if (!GlobalDefinitions.localControl)
                {
                    GlobalDefinitions.SetGUIForNonLocalControl();
                }

                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedInvasionState>().ExecuteSelectUnit;

                GUIRoutines.RemoveGUI(transform.parent.gameObject);
            }
        }
コード例 #5
0
        public void NewSavedGameOK()
        {
            if (GlobalDefinitions.newGameToggle.GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToLogFile("newSavedGameOK: Starting new game");

                GUIRoutines.RemoveGUI(transform.parent.gameObject);
                GameControl.setUpStateInstance.GetComponent <SetUpState>().ExecuteNewGame();
            }
            else if (GlobalDefinitions.savedGameToggle.GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToLogFile("newSavedGameOK: Starting saved game");

                // Since at this point we know we are starting a new game and not running the command file, remove the command file
                if (!GlobalDefinitions.commandFileBeingRead)
                {
                    GlobalDefinitions.DeleteCommandFile();
                }

                GUIRoutines.RemoveGUI(transform.parent.gameObject);
                GameControl.setUpStateInstance.GetComponent <SetUpState>().ExecuteSavedGame();
            }
            else if (GlobalDefinitions.commandFileToggle.GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToLogFile("newSavedGameOK: Executing command file");

                GUIRoutines.RemoveGUI(transform.parent.gameObject);
                GameControl.setUpStateInstance.GetComponent <SetUpState>().ReadCommandFile();
            }
        }
コード例 #6
0
        /// <summary>
        /// Executed when the ok button is selected on the supply sources gui for supply assignment.  At the end of a phase.
        /// </summary>
        public void OkSupplyWithEndPhase()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.OKSUPPLYWITHENDPHASEKEYWORD + " " + name);

            // Reset all highlighting
            foreach (GameObject unit in GlobalDefinitions.alliedUnitsOnBoard)
            {
                GlobalDefinitions.UnhighlightUnit(unit);
                if (unit.GetComponent <UnitDatabaseFields>().inSupply)
                {
                    unit.GetComponent <UnitDatabaseFields>().supplyIncrementsOutOfSupply = 0;
                }
            }

            GameControl.supplyRoutinesInstance.GetComponent <SupplyRoutines>().CheckIfAlliedUnsuppliedUnitsShouldBeEliminated(false);
            GUIRoutines.RemoveGUI(GlobalDefinitions.supplySourceGUIInstance);

            // Got rid of the GUI, now get rid of the global copies of the supply gui's
            //int count = GlobalDefinitions.supplyGUI.Count;
            //for (int i = 0; i < count; i++)
            //    DestroyImmediate(GlobalDefinitions.supplyGUI[i]);
            //GlobalDefinitions.supplyGUI.Clear();

            // Turn the button back on
            GameObject.Find("SupplySourcesButton").GetComponent <Button>().interactable = true;

            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.ExecuteQuit();
        }
コード例 #7
0
        public void MultiUnitSelection()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.TACAIRMULTIUNITSELECTIONKEYWORD + " " + name);

            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);
            CombatResolutionRoutines.AddInterdictedUnitToList(unit);
        }
コード例 #8
0
        /// <summary>
        /// Called to exit the supply gui when used for display
        /// </summary>
        public void OkSupply()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.OKSUPPLYKEYWORD + " " + name);

            // Reset all highlighting
            foreach (GameObject unit in GlobalDefinitions.alliedUnitsOnBoard)
            {
                GlobalDefinitions.UnhighlightUnit(unit);
                if (unit.GetComponent <UnitDatabaseFields>().inSupply)
                {
                    unit.GetComponent <UnitDatabaseFields>().supplyIncrementsOutOfSupply = 0;
                }
            }

            // I need to know whether this is the beginning or end of a turn since unsupplied units are only eliminated at the end of a turn
            // With the implementation of the AI there is no Allied supply state but I think that the check at the end of combat doesn't come through this path... which might not be right
            //if (GameControl.gameStateControlInstance.GetComponent<gameStateControl>().currentState == GameControl.alliedSupplyStateInstance.GetComponent<SupplyState>())
            GameControl.supplyRoutinesInstance.GetComponent <SupplyRoutines>().CheckIfAlliedUnsuppliedUnitsShouldBeEliminated(false);
            //else
            //GameControl.supplyRoutinesInstance.GetComponent<SupplyRoutines>().checkIfAlliedUnsuppliedUnitsShouldBeEliminated(true);

            // Turn the button back on
            GameObject.Find("SupplySourcesButton").GetComponent <Button>().interactable = true;

            GUIRoutines.RemoveGUI(GlobalDefinitions.supplySourceGUIInstance);
        }
コード例 #9
0
        public void AddRiverInterdiction()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.ADDRIVERINTERDICTIONKEYWORD);

            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedTacticalAirState>().ExecuteRiverInterdictionSelection;
            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);
        }
コード例 #10
0
        public static void TacticalAirOK()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.EXECUTETACTICALAIROKKEYWORD);

            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);

            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.ExecuteQuit();
        }
コード例 #11
0
        public void AddCloseDefenseHex()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.ADDCLOSEDEFENSEKEYWORD);

            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedTacticalAirState>().ExecuteCloseDefenseSelection;
            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);
        }
コード例 #12
0
        public void SelectUnitToMove()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.MULTIUNITSELECTIONKEYWORD + " " + name);

            List <GameObject> movementHexes = new List <GameObject>();

            if (GetComponent <Toggle>().isOn)
            {
                if (unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("Unit selected is committed to an attack\nCancel attack if you want to move this unit");
                    GetComponent <Toggle>().isOn = false;
                }
                else
                {
                    GlobalDefinitions.HighlightUnit(unit);
                    GlobalDefinitions.selectedUnit = unit;
                    GlobalDefinitions.startHex     = unit.GetComponent <UnitDatabaseFields>().occupiedHex;

                    // We don't want to highlight the movement hexes if we're in setup mode
                    if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name != "setUpStateInstance")
                    {
                        movementHexes = GameControl.movementRoutinesInstance.GetComponent <MovementRoutines>().ReturnAvailableMovementHexes(GlobalDefinitions.startHex, GlobalDefinitions.selectedUnit);

                        foreach (GameObject hex in movementHexes)
                        {
                            GlobalDefinitions.HighlightHexForMovement(hex);
                        }
                    }

                    GUIRoutines.RemoveGUI(transform.parent.gameObject);

                    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>().ExecuteSelectUnitDestination;
                    }
                    else if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "setUpStateInstance")
                    {
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <SetUpState>().ExecuteSelectUnitDestination;
                    }

                    //if (GlobalDefinitions.localControl && (GlobalDefinitions.gameMode == GlobalDefinitions.GameModeValues.Network))
                    //    GameControl.sendMouseClickToNetwork(GlobalDefinitions.selectedUnit, GlobalDefinitions.startHex);
                }
            }

            else
            {
                // This actually should never happen since when the toggle is selected the gui is removed so there is never a chance to unselect the toggle
                GUIRoutines.RemoveGUI(transform.parent.gameObject);
            }
        }
コード例 #13
0
        /// <summary>
        /// This routine switches the supply status of the unit selected from the multi-unit gui
        /// </summary>
        public void SelectFromMultiUnits()
        {
            if (GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.CHANGESUPPLYSTATUSKEYWORD + " " + name);

                GameControl.supplyRoutinesInstance.GetComponent <SupplyRoutines>().SwapSupplyStatus(unit);
            }
            GUIRoutines.RemoveGUI(transform.parent.gameObject);
            GlobalDefinitions.supplySourceGUIInstance.SetActive(true);
        }
コード例 #14
0
        /// <summary>
        /// This routine executes when the player hits the button to indicate that they will be playing the German side
        /// </summary>
        public void GermanButtonSelected()
        {
            GlobalDefinitions.nationalityUserIsPlaying = GlobalDefinitions.Nationality.German;
            GlobalDefinitions.commandFileHeader       += " German";
            GameControl.CreateStatesForAI(GlobalDefinitions.Nationality.German);
            GlobalDefinitions.gameMode    = GlobalDefinitions.GameModeValues.AI;
            GlobalDefinitions.gameStarted = true; // Set true here since there is no network setup
            GlobalDefinitions.SwitchLocalControl(true);
            GUIRoutines.RemoveGUI(transform.parent.gameObject);

            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState = GameControl.setUpStateInstance.GetComponent <SetUpState>();
            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.Initialize();
            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod(GameControl.inputMessage.GetComponent <InputMessage>());
        }
コード例 #15
0
        /// <summary>
        /// Called when the cancel button is selected
        /// </summary>
        public void CancelSelected()
        {
            // Get rid of the gui
            GUIRoutines.RemoveGUI(transform.parent.gameObject);

            // Bring back any gui's that were active before this was called
            foreach (GameObject gui in GUIRoutines.guiList)
            {
                gui.SetActive(true);
            }

            // Turn the button back on
            GameObject.Find("SettingsButton").GetComponent <Button>().interactable = true;
        }
コード例 #16
0
        // Cancels the combat assignment
        public void CancelCombatGUISelection()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.COMBATGUICANCELKEYWORD + " " + name);

            foreach (GameObject unit in singleCombat.GetComponent <Combat>().defendingUnits)
            {
                GlobalDefinitions.UnhighlightUnit(unit);
                unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = false;
            }

            foreach (GameObject unit in singleCombat.GetComponent <Combat>().attackingUnits)
            {
                GlobalDefinitions.UnhighlightUnit(unit);
                unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = false;
            }

            Destroy(singleCombat);
            GUIRoutines.RemoveGUI(GlobalDefinitions.combatGUIInstance);

            if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance") ||
                GlobalDefinitions.MustAttackToggle.GetComponent <Toggle>().isOn)
            {
                CombatRoutines.CheckIfRequiredUnitsAreUncommitted(GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality, true);
            }

            // Determine what state we are in and set the next executeMethod
            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;
            }
            if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance"))
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteSelectUnit;
            }
            if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedInvasionStateInstance")
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedInvasionState>().ExecuteSelectUnit;
            }
            if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedAirborneStateInstance")
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedAirborneState>().ExecuteSelectUnit;
            }
        }
コード例 #17
0
        /// <summary>
        /// This routine executes when the player hits the button to indicate that they will be playing the Allied side
        /// </summary>
        public void AllyButtonSelected()
        {
            GlobalDefinitions.nationalityUserIsPlaying = GlobalDefinitions.Nationality.Allied;
            GlobalDefinitions.commandFileHeader       += " Allied";
            GameControl.CreateStatesForAI(GlobalDefinitions.Nationality.Allied);
            GlobalDefinitions.gameMode    = GlobalDefinitions.GameModeValues.AI;
            GlobalDefinitions.gameStarted = true; // Set true here since there is no network setup
            GlobalDefinitions.SwitchLocalControl(true);
            GUIRoutines.RemoveGUI(transform.parent.gameObject);

            // Call the setup routine.  The user will indicate whether they are playing a saved or new game there.
            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState = GameControl.germanAISetupStateInstance.GetComponent <GermanAISetupState>();
            GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.Initialize();
            // Note there is no execute method for the German AI state
        }
コード例 #18
0
        /// <summary>
        /// Executes when the OK button on the combat resolution screen is clicked
        /// </summary>
        public void Ok()
        {
            // If network game notify the remote system to execute OK
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.COMBATOKKEYWORD + " " + name);

            if (GetComponentInChildren <Text>().text == "Continue")
            {
                GUIRoutines.RemoveGUI(GlobalDefinitions.combatResolutionGUIInstance);

                // Turn the button back on
                GameObject.Find("ResolveCombatButton").GetComponent <Button>().interactable = true;

                // Determine what state we are in and set the next executeMethod
                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;
                }
                if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                    (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance"))
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteSelectUnit;
                }
                if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedInvasionStateInstance")
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedInvasionState>().ExecuteSelectUnit;
                }
                if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedAirborneStateInstance")
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedAirborneState>().ExecuteSelectUnit;
                }
            }
            else
            {
                // Turn the button back on
                GameObject.Find("ResolveCombatButton").GetComponent <Button>().interactable = true;

                GUIRoutines.RemoveGUI(GlobalDefinitions.combatResolutionGUIInstance);

                GlobalDefinitions.allCombats.Clear();

                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteQuit();
            }
        }
コード例 #19
0
        public void CancelInterdictedUnit()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.CANCELUNITINTERDICTIONKEYWORD + " " + name);

            for (int index = 0; index < GlobalDefinitions.interdictedUnits.Count; index++)
            {
                if (GlobalDefinitions.interdictedUnits[index] == unit)
                {
                    GlobalDefinitions.interdictedUnits[index].GetComponent <UnitDatabaseFields>().unitInterdiction = false;
                    GlobalDefinitions.interdictedUnits.Remove(unit);
                }
            }
            GlobalDefinitions.tacticalAirMissionsThisTurn--;
            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);
            CombatResolutionRoutines.CreateTacticalAirGUI();
        }
コード例 #20
0
        public void CancelCloseDefense()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.CANCELCLOSEDEFENSEKEYWORD + " " + name);

            for (int index = 0; index < GlobalDefinitions.closeDefenseHexes.Count; index++)
            {
                if (GlobalDefinitions.closeDefenseHexes[index] == hex)
                {
                    GlobalDefinitions.closeDefenseHexes[index].GetComponent <HexDatabaseFields>().closeDefenseSupport = false;
                    GlobalDefinitions.UnhighlightHex(GlobalDefinitions.closeDefenseHexes[index]);
                    GlobalDefinitions.closeDefenseHexes.Remove(hex);
                }
            }
            GlobalDefinitions.tacticalAirMissionsThisTurn--;
            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);
            CombatResolutionRoutines.CreateTacticalAirGUI();
        }
コード例 #21
0
        public void CancelRiverInterdiction()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.CANCELRIVERINTERDICTIONKEYWORD + " " + name);

            for (int index = 0; index < GlobalDefinitions.riverInderdictedHexes.Count; index++)
            {
                if (GlobalDefinitions.riverInderdictedHexes[index] == hex)
                {
                    GlobalDefinitions.riverInderdictedHexes[index].GetComponent <HexDatabaseFields>().riverInterdiction = false;
                    GlobalDefinitions.UnhighlightHex(GlobalDefinitions.riverInderdictedHexes[index]);
                    GlobalDefinitions.riverInderdictedHexes.Remove(hex);
                }
            }
            GlobalDefinitions.tacticalAirMissionsThisTurn--;
            GUIRoutines.RemoveGUI(GlobalDefinitions.tacticalAirGUIInstance);
            CombatResolutionRoutines.CreateTacticalAirGUI();
        }
コード例 #22
0
 public void CarpetBombingOK()
 {
     GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.CARPETBOMBINGOKKEYWORD + " " + name);
     foreach (Transform childTransform in transform.parent.transform)
     {
         if (childTransform.gameObject.GetComponent <Toggle>() != null)
         {
             if (childTransform.gameObject.GetComponent <Toggle>().isOn)
             {
                 childTransform.gameObject.GetComponent <CarpetBombingToggleRoutines>().hex.GetComponent <HexDatabaseFields>().carpetBombingActive = true;
                 GlobalDefinitions.numberOfCarpetBombingsUsed++;
                 GlobalDefinitions.carpetBombingUsedThisTurn = true;
             }
         }
     }
     GUIRoutines.RemoveGUI(transform.parent.gameObject);
     GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod = GameControl.alliedCombatStateInstance.GetComponent <CombatState>().ExecuteSelectUnit;
 }
 public void CarpetBombingResultsSelected()
 {
     if (gameObject.GetComponent <Toggle>().isOn)
     {
         if ((GlobalDefinitions.gameMode == GlobalDefinitions.GameModeValues.Peer2PeerNetwork) && (!GlobalDefinitions.localControl))
         {
             GUIRoutines.RemoveGUI(transform.parent.gameObject);
             CombatResolutionRoutines.ExecuteCombatResults(defendingUnits, attackingUnits, combatOdds, dieRollResult, combatResults, buttonLocation);
         }
         else
         {
             GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.COMBATRESOLUTIONSELECTEDKEYWORD + " " + GlobalDefinitions.CombatResultToggleName);
             GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.CARPETBOMBINGRESULTSSELECTEDKEYWORD + " " + name + " " + dieRollResult);
             GUIRoutines.RemoveGUI(transform.parent.gameObject);
             CombatResolutionRoutines.ExecuteCombatResults(defendingUnits, attackingUnits, combatOdds, dieRollResult, combatResults, buttonLocation);
         }
     }
 }
コード例 #24
0
        /// <summary>
        /// Executes when the cancel button is pressed
        /// </summary>
        public void CancelGui()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.MULTIUNITSELECTIONCANCELKEYWORD + " " + name);

            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 == "setUpStateInstance")
            {
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <SetUpState>().ExecuteSelectUnit;
            }

            GUIRoutines.RemoveGUI(transform.parent.gameObject);
        }
コード例 #25
0
        /// <summary>
        /// Called when a unit is selected from the gui to retreat when there are multiple units avaialble
        /// </summary>
        public void SelectUnitsToMove()
        {
            if (GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.RETREATSELECTIONKEYWORD + " " + name);

                // The unit has been selected so move it to the zero position in the list since that is what will be moved
                GlobalDefinitions.retreatingUnits.Remove(GetComponent <RetreatToggleRoutines>().unit);
                GlobalDefinitions.retreatingUnits.Insert(0, GetComponent <RetreatToggleRoutines>().unit);

                List <GameObject> retreatHexes = CombatResolutionRoutines.ReturnRetreatHexes(GetComponent <RetreatToggleRoutines>().unit);
                if (retreatHexes.Count > 0)
                {
                    GlobalDefinitions.HighlightUnit(unit);
                    foreach (GameObject hex in retreatHexes)
                    {
                        GlobalDefinitions.HighlightHexForMovement(hex);
                    }
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteRetreatMovement;
                }

                // This executes when there is no retreat available for the unit.  While the units without retreat available is checked early on,
                // this is a case where there was more than one unit that needed to retreat but there wasn't room for all of them
                else
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("No retreat available - eliminating unit" + unit.name);
                    GlobalDefinitions.MoveUnitToDeadPile(unit);
                    GlobalDefinitions.retreatingUnits.RemoveAt(0);

                    // Need to call selection routines in case there are more units that cannot retreat
                    CombatResolutionRoutines.SelectUnitsForRetreat();
                }
                GUIRoutines.RemoveGUI(transform.parent.gameObject);
            }
        }
コード例 #26
0
        /// <summary>
        /// Executes when the OK button is selected
        /// </summary>
        public void OkGameMode()
        {
            if (MainMenuRoutines.hotseatToggle.GetComponent <Toggle>().isOn)
            {
                GlobalDefinitions.WriteToLogFile("okGameMode: Setting up hotseat mode");
                GlobalDefinitions.gameMode          = GlobalDefinitions.GameModeValues.Hotseat;
                GlobalDefinitions.commandFileHeader = "Hotseat";
                GameControl.CreateStatesForHotSeatOrNetwork();
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState = GameControl.setUpStateInstance.GetComponent <SetUpState>();
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.Initialize();
                GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod(GameControl.inputMessage.GetComponent <InputMessage>());
                GlobalDefinitions.gameStarted = true;
                GlobalDefinitions.SwitchLocalControl(true);
                GUIRoutines.RemoveGUI(transform.parent.gameObject);
            }
            else if (MainMenuRoutines.AIToggle.GetComponent <Toggle>().isOn)
            {
                // Note: unlike hotseat or network the state transitions in AI are determined by the side being played so the state creation is called in the button routines
                // that are invoked by the user selecting the side to play
                GlobalDefinitions.WriteToLogFile("okGameMode: Setting up AI mode");
                GlobalDefinitions.commandFileHeader = "AI";
                GlobalDefinitions.AskUserWhichSideToPlay();
                GUIRoutines.RemoveGUI(transform.parent.gameObject);
            }
            //else if (MainMenuRoutines.peerToPeerNetworkToggle.GetComponent<Toggle>().isOn)
            //{
            //    GlobalDefinitions.WriteToLogFile("okGameMode: Setting up Peer to Peer Network mode");
            //    GlobalDefinitions.gameMode = GlobalDefinitions.GameModeValues.Peer2PeerNetwork;
            //    GlobalDefinitions.commandFileHeader = "Peer2PeerNetwork";
            //    GameControl.CreateStatesForHotSeatOrNetwork();
            //    //GameControl.fileTransferServerInstance.GetComponent<FileTransferServer>().initiateFileTransferServer();
            //    MainMenuRoutines.NetworkSettingsUI();

            //    GUIRoutines.RemoveGUI(transform.parent.gameObject);
            //}
        }
コード例 #27
0
        /// <summary>
        /// Executes when the user indicates he wants to go to main menu
        /// </summary>
        public void YesMain()
        {
            List <GameObject> removeUnitList = new List <GameObject>();

            // If this is a network game I've already checked that the player is in control
            //if (GlobalDefinitions.gameMode == GlobalDefinitions.GameModeValues.Peer2PeerNetwork)
            //{
            //    GlobalDefinitions.WriteToLogFile("YesMain: Calling ResetConnection()");
            //    //byte error;
            //    //NetworkTransport.Disconnect(TransportScript.receivedHostId, TransportScript.gameConnectionId, out error);
            //    //Network.Disconnect();
            //    TransportScript.ResetConnection(TransportScript.computerId);
            //}

            // Copy list so the guis can be removed
            List <GameObject> removeList = new List <GameObject>();

            foreach (GameObject gui in GUIRoutines.guiList)
            {
                removeList.Add(gui);
            }


            // Get rid of all active guis
            foreach (GameObject gui in removeList)
            {
                GUIRoutines.RemoveGUI(gui);
            }

            // Put all the units back on the OOB sheet
            foreach (Transform unit in GlobalDefinitions.allUnitsOnBoard.transform)
            {
                unit.GetComponent <UnitDatabaseFields>().unitInterdiction      = false;
                unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = false;
                unit.GetComponent <UnitDatabaseFields>().hasMoved                    = false;
                unit.GetComponent <UnitDatabaseFields>().unitEliminated              = false;
                unit.GetComponent <UnitDatabaseFields>().occupiedHex                 = null;
                unit.GetComponent <UnitDatabaseFields>().beginningTurnHex            = null;
                unit.GetComponent <UnitDatabaseFields>().invasionAreaIndex           = -1;
                unit.GetComponent <UnitDatabaseFields>().inSupply                    = true;
                unit.GetComponent <UnitDatabaseFields>().supplySource                = null;
                unit.GetComponent <UnitDatabaseFields>().supplyIncrementsOutOfSupply = 0;
                unit.GetComponent <UnitDatabaseFields>().remainingMovement           = unit.GetComponent <UnitDatabaseFields>().movementFactor;
                if (unit.GetComponent <UnitDatabaseFields>().occupiedHex != null)
                {
                    GlobalDefinitions.UnhighlightUnit(unit.gameObject);
                    GeneralHexRoutines.RemoveUnitFromHex(unit.gameObject, unit.GetComponent <UnitDatabaseFields>().occupiedHex);
                    unit.GetComponent <UnitDatabaseFields>().occupiedHex = null;
                }

                removeUnitList.Add(unit.gameObject);
            }

            foreach (GameObject unit in removeUnitList)
            {
                GlobalDefinitions.ReturnUnitToOOBShet(unit);
            }

            // Clear out the lists keeping track of both side's units on board
            GlobalDefinitions.alliedUnitsOnBoard.Clear();
            GlobalDefinitions.germanUnitsOnBoard.Clear();

            // Go through the hexes and reset all highlighting
            foreach (GameObject hex in HexDefinitions.allHexesOnBoard)
            {
                hex.GetComponent <HexDatabaseFields>().riverInterdiction   = false;
                hex.GetComponent <HexDatabaseFields>().closeDefenseSupport = false;
                hex.GetComponent <HexDatabaseFields>().successfullyInvaded = false;
                hex.GetComponent <HexDatabaseFields>().alliedControl       = false;
                hex.GetComponent <HexDatabaseFields>().inAlliedZOC         = false;
                hex.GetComponent <HexDatabaseFields>().inGermanZOC         = false;
                hex.GetComponent <HexDatabaseFields>().occupyingUnit.Clear();
                hex.GetComponent <HexDatabaseFields>().unitsExertingZOC.Clear();
                hex.GetComponent <HexDatabaseFields>().availableForMovement       = false;
                hex.GetComponent <HexDatabaseFields>().strategicRemainingMovement = 0;
                hex.GetComponent <HexDatabaseFields>().remainingMovement          = 0;
                hex.GetComponent <HexDatabaseFields>().supplySources.Clear();
                hex.GetComponent <HexDatabaseFields>().unitsThatCanBeSupplied.Clear();
                hex.GetComponent <HexDatabaseFields>().closeDefenseSupport = false;
                hex.GetComponent <HexDatabaseFields>().riverInterdiction   = false;
                hex.GetComponent <HexDatabaseFields>().carpetBombingActive = false;

                GlobalDefinitions.UnhighlightHex(hex.gameObject);
            }

            GlobalDefinitions.WriteToLogFile("Putting Allied units in Britain");
            // When restarting a game the units won't have their Britain location loaded so this needs to be done before a restart file is read
            GameControl.createBoardInstance.GetComponent <CreateBoard>().ReadBritainPlacement(GlobalGameFields.britainUnitLocationFile);

            GlobalDefinitions.ResetAllGlobalDefinitions();

            // Turn the button back on
            GlobalDefinitions.mainMenuButton.GetComponent <Button>().interactable = true;

            MainMenuRoutines.GetGameModeUI();
        }
コード例 #28
0
 /// <summary>
 /// Sets variables for a no response
 /// </summary>
 public void NoButtonSelected()
 {
     GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.NOBUTTONSELECTEDKEYWORD);
     GUIRoutines.RemoveGUI(transform.parent.gameObject);
     noAction();
 }
コード例 #29
0
        /// <summary>
        /// This executes when the OK button on the combat assignment gui is pressed
        /// </summary>
        public void OkCombatGUISelection()
        {
            Button            yesButton  = null;
            Button            noButton   = null;
            List <GameObject> removeUnit = new List <GameObject>();

            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.COMBATGUIOKKEYWORD + " " + name);

            removeUnit.Clear();

            // Get a list of the defending units that were not added to the combat
            foreach (GameObject unit in singleCombat.GetComponent <Combat>().defendingUnits)
            {
                if (!unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                {
                    removeUnit.Add(unit);
                }
            }

            // Now go through the defenders and remove non-committed units from the combat
            foreach (GameObject unit in removeUnit)
            {
                singleCombat.GetComponent <Combat>().defendingUnits.Remove(unit);
            }

            removeUnit.Clear();

            // Get a list of the attacking units that were not added to the combat
            foreach (GameObject unit in singleCombat.GetComponent <Combat>().attackingUnits)
            {
                if (!unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack)
                {
                    removeUnit.Add(unit);
                }
            }

            // Now go through the attackers and remove non-committed units from the combat
            foreach (GameObject unit in removeUnit)
            {
                singleCombat.GetComponent <Combat>().attackingUnits.Remove(unit);
            }

            // Need to check if the user has selected both attackers and defenders.  If not then nothing should be changed
            if ((singleCombat.GetComponent <Combat>().attackingUnits.Count == 0) || (singleCombat.GetComponent <Combat>().defendingUnits.Count == 0))
            {
                NoAbort();
            }

            // Check for if a combat is being selected that is less than 1:6 odds - this is useless but need to check just in case
            else if (GlobalDefinitions.ConvertOddsToString(CalculateBattleOddsRoutines.ReturnCombatGUICombatOdds(
                                                               singleCombat.GetComponent <Combat>().defendingUnits, singleCombat.GetComponent <Combat>().attackingUnits)) == "1:7")
            {
                // If the odds or worse than 1:6 then the attackers are eliminated and no battle takes place.  It does not
                // count as an attack on the defending units

                // Turn off the combat assignment gui before brining up the yes/no question so the user doesn't select any of the buttons on the gui before answering the
                // question which creates all kinds of problems
                transform.parent.gameObject.SetActive(false);

                GlobalDefinitions.AskUserYesNoQuestion("Attacking at odds less than 1:6 is useless: do you want to continue?  Note that if Yes is selected the attackers will be eliminated and this will not count as a combat if you are trying to use this as a soak-off attack", ref yesButton, ref noButton, YesContinue, NoAbort, 4f, 5f);
            }

            else
            {
                foreach (Transform childTransform in transform.parent.transform)
                {
                    if ((childTransform.GetComponent <CombatToggleRoutines>() != null) &&
                        (childTransform.GetComponent <CombatToggleRoutines>().unit != null))
                    {
                        //if (childTransform.GetComponent<Toggle>().isOn && GlobalDefinitions.localControl)  I removed the local control check here because units on the remote computer and not being reset.  The local control check was added for a reason, though, and I don't know why which is why I'm leaving this here as a comment
                        if (childTransform.GetComponent <Toggle>().isOn)
                        {
                            GlobalDefinitions.UnhighlightUnit(childTransform.GetComponent <CombatToggleRoutines>().unit);
                            childTransform.GetComponent <CombatToggleRoutines>().unit.GetComponent <UnitDatabaseFields>().isCommittedToAnAttack = true;
                        }
                    }
                }

                // Check whether air support is to be used in this attack
                if (GlobalDefinitions.combatAirSupportToggle != null)
                {
                    if (GlobalDefinitions.combatAirSupportToggle.GetComponent <Toggle>().isOn)
                    {
                        singleCombat.GetComponent <Combat>().attackAirSupport = true;
                    }
                    else
                    {
                        singleCombat.GetComponent <Combat>().attackAirSupport = false;
                    }
                }

                // Check if carpet bombing is to be used in this attack
                if (GlobalDefinitions.combatCarpetBombingToggle != null)
                {
                    if (GlobalDefinitions.combatCarpetBombingToggle.GetComponent <Toggle>().isOn)
                    {
                        GlobalDefinitions.carpetBombingUsedThisTurn = true;
                        GlobalDefinitions.numberOfCarpetBombingsUsed++;
                        singleCombat.GetComponent <Combat>().carpetBombing = true;
                        singleCombat.GetComponent <Combat>().defendingUnits[0].GetComponent <UnitDatabaseFields>().occupiedHex.GetComponent <HexDatabaseFields>().carpetBombingActive = true;
                    }
                    else
                    {
                        singleCombat.GetComponent <Combat>().carpetBombing = false;
                    }
                }

                GlobalDefinitions.allCombats.Add(singleCombat);
                GUIRoutines.RemoveGUI(GlobalDefinitions.combatGUIInstance);

                // Check if the Must Attack toggle is on and if it is highlight uncommitted units that must participate in an attack
                if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                    (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance") ||
                    GlobalDefinitions.MustAttackToggle.GetComponent <Toggle>().isOn)
                {
                    CombatRoutines.CheckIfRequiredUnitsAreUncommitted(GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality, true);
                }

                // Determine what state we are in and set the next executeMethod
                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;
                }
                if ((GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedCombatStateInstance") ||
                    (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "germanCombatStateInstance"))
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <CombatState>().ExecuteSelectUnit;
                }
                if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedInvasionStateInstance")
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedInvasionState>().ExecuteSelectUnit;
                }
                if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.name == "alliedAirborneStateInstance")
                {
                    GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.executeMethod =
                        GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.GetComponent <AlliedAirborneState>().ExecuteSelectUnit;
                }
            }
        }
コード例 #30
0
        /// <summary>
        /// This routine is called when the user selects the Resolve button for a combat
        /// </summary>
        public void ResolutionSelected()
        {
            // Write out the name of the toggle being executed in order to send it once the die roll is known
            if (GlobalDefinitions.localControl)
            {
                GlobalDefinitions.CombatResultToggleName = name;
            }

            // If combat resolution hasn't started then check to make sure all required combats have been created
            if (!GlobalDefinitions.combatResolutionStarted)
            {
                if (CombatRoutines.CheckIfRequiredUnitsAreUncommitted(GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality, true))
                {
                    GlobalDefinitions.GuiUpdateStatusMessage("Cannot start combat resolution, highlighted units must be committed to combat first.");
                }
                else
                {
                    // All required units are attacking or being attacked
                    GlobalDefinitions.combatResolutionStarted = true;

                    // Get rid of the "Continue" button since combat resolution has started
                    GlobalDefinitions.combatResolutionOKButton.SetActive(false);

                    // Once combat resolution starts, canceling an attack is no longer an option so get rid of all cancel buttons
                    // Also can't assign any more air support so make those toggles non-interactive
                    foreach (GameObject combat in GlobalDefinitions.allCombats)
                    {
                        if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality == GlobalDefinitions.Nationality.Allied)
                        {
                            combat.GetComponent <Combat>().airSupportToggle.interactable = false;
                        }
                        DestroyImmediate(combat.GetComponent <Combat>().cancelButton.gameObject);
                    }

                    // Only check for carpet bombing if Allies are attacking.  This is needed to keep the German attacks from being loaded
                    if (GameControl.gameStateControlInstance.GetComponent <GameStateControl>().currentState.currentNationality == GlobalDefinitions.Nationality.Allied)
                    {
                        GlobalDefinitions.combatResultsFromLastTurn.Clear();
                        GlobalDefinitions.hexesAttackedLastTurn.Clear();
                        // Store all hexes being attacked this turn.  Used for carpet bombing availability next turn
                        foreach (GameObject combat in GlobalDefinitions.allCombats)
                        {
                            foreach (GameObject defender in combat.GetComponent <Combat>().defendingUnits)
                            {
                                if (!GlobalDefinitions.hexesAttackedLastTurn.Contains(defender.GetComponent <UnitDatabaseFields>().occupiedHex))
                                {
                                    GlobalDefinitions.hexesAttackedLastTurn.Add(defender.GetComponent <UnitDatabaseFields>().occupiedHex);
                                }
                            }
                        }
                    }
                }
            }

            if (GlobalDefinitions.combatResolutionStarted)
            {
                CombatResolutionRoutines.DetermineCombatResults(curentCombat, gameObject.GetComponent <RectTransform>().anchoredPosition);

                // Get rid of the locate button on the attack being resolved, can't gaurantee that the units are still there after resolution
                DestroyImmediate(curentCombat.GetComponent <Combat>().locateButton.gameObject);
                //Get rid of the resolve button since the battle has been resolved.  This is also used to determine if all combats have been resolved.
                //DestroyImmediate(GameObject.Find(GlobalDefinitions.CombatResultToggleName));
                GUIRoutines.RemoveGUI(gameObject);
            }

            // Check if all the attacks have been resolved by seeing if there are any more Resolve buttons left
            bool allAttacksResolved = true;

            foreach (GameObject combat in GlobalDefinitions.allCombats)
            {
                if (combat.GetComponent <Combat>().resolveButton != null)
                {
                    allAttacksResolved = false;
                }
            }

            // If all attacks have been resolved turn on the quit button (which is the continue button with the text changed
            if (allAttacksResolved)
            {
                GlobalDefinitions.combatResolutionOKButton.SetActive(true);
                GlobalDefinitions.combatResolutionOKButton.GetComponent <Button>().GetComponentInChildren <Text>().text = "Quit";
            }
        }