Esempio n. 1
0
        /// <summary>
        /// This routine processes the chagne in the toggle displaying the German supply range
        /// </summary>
        public void DisplayGermanSupplyRange()
        {
            GlobalDefinitions.WriteToCommandFile(GlobalDefinitions.DISPLAYGERMANSUPPLYRANGETOGGLEWORD);

            if (gameObject.GetComponent <Toggle>().isOn)
            {
                // Check if the German supply range is being displayed, it must be turned off first otherwise we will get confused
                if (GlobalDefinitions.displayAlliedSupplyStatus)
                {
                    GameObject.Find("AlliedSupplyToggle").GetComponent <Toggle>().isOn = false;
                }

                // Set the global variable so the other unhighlighing can be processed properly
                GlobalDefinitions.displayGermanSupplyStatus = true;
                // Highlight all hexes that have supply available
                foreach (GameObject hex in HexDefinitions.allHexesOnBoard)
                {
                    if (hex.GetComponent <HexDatabaseFields>().germanInSupply)
                    {
                        GlobalDefinitions.HighlightHexInSupply(hex);
                    }
                }
            }
            else
            {
                // Set the global variable so the other unhighlighing can be processed properly
                GlobalDefinitions.displayGermanSupplyStatus = false;
                // Turn off supply highlighting
                foreach (GameObject hex in HexDefinitions.allHexesOnBoard)
                {
                    GlobalDefinitions.UnhighlightHexSupplyRange(hex);
                }
            }
        }