Ejemplo n.º 1
0
        IEnumerator TransferProvinces()
        {
            // Reset map
            map.ReloadData();
            map.Redraw();

            // Transfer some German provinces to Poland
            int countryIndex = map.GetCountryIndex("Poland");

            // Step 1: Focus on area of provinces
            map.showProvinces    = true;
            map.drawAllProvinces = true;
            map.FlyToProvince("Germany", "Brandenburg", 1f, 0.04f);
            yield return(new WaitForSeconds(1f));

            // Step 2: Mark provinces
            string[] provincesToTransfer = new string[] {
                "Brandenburg",
                "Mecklenburg-Vorpommern",
                "Sachsen-Anhalt",
                "Sachsen",
                "Thüringen"
            };
            foreach (string provinceName in provincesToTransfer)
            {
                int provinceIndex = map.GetProvinceIndex("Germany", provinceName);
                map.BlinkProvince(provinceIndex, Color.white, Color.red, 2f, 0.15f);
                LineMarkerAnimator lma = map.AddLine(new Vector2[] {
                    map.provinces [provinceIndex].center,
                    map.countries [countryIndex].center
                }, Color.yellow, 1f, 0.15f);
                lma.dashInterval          = 0.0001f;
                lma.dashAnimationDuration = 0.3f;
                lma.drawingDuration       = 2.5f;
                lma.autoFadeAfter         = 0.5f;
                lma.fadeOutDuration       = 0f;
            }
            yield return(new WaitForSeconds(3f));

            // Step 3: transfer some German provinces to Poland
            foreach (string provinceName in provincesToTransfer)
            {
                Province province = map.GetProvince(provinceName, "Germany");
                if (!map.CountryTransferProvinceRegion(countryIndex, province.mainRegion, false))
                {
                    Debug.LogError("Could not transfer province " + provinceName + " to Poland.");
                }
            }
            map.Redraw();

            // End

            map.FlyToCountry("Poland", 1f, 0.04f);
            map.BlinkCountry("Poland", Color.white, Color.green, 2f, 0.15f);

            Debug.Log("Done.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event function triggered by the "Zoom in" button click
        /// </summary>
        public void ZoomIn()
        {
            // Take the province id
            string provinceName  = provincesDropdown.options [provincesDropdown.value].text;
            string countryName   = countriesDropdown.options[countriesDropdown.value].text;
            int    provinceIndex = map.GetProvinceIndex(countryName, provinceName);

            // Color and zoom in the province
            map.ToggleProvinceSurface(provinceIndex, true, new Color(0, 1, 0, 0.5f));
            map.FlyToProvince(provinceIndex, 2f, 0.1f);
        }