Esempio n. 1
0
        // Utility functions called from OnGUI:
        void FlyToCountry(int countryIndex)
        {
            // Get zoom level for the extents of the country
            float zoomLevel = map.GetCountryRegionZoomExtents(countryIndex);

            map.FlyToCountry(countryIndex, 2.0f, zoomLevel);
            map.BlinkCountry(countryIndex, Color.green, Color.black, 4.0f, 2.5f);
        }
Esempio n. 2
0
        void Start()
        {
            // 1) Get a reference to the WMSK API
            map = WMSK.instance;

            // 2) Create the dummy background country named "Pool" and move all provinces to it
            map.CountryCreateProvincesPool("Pool", true);

            // 3) Create a new country from province "Yunnan" in the pool of provinces (previously part of China)
            Province province           = map.GetProvince("Yunnan", "Pool");
            int      yunnanCountryIndex = map.ProvinceToCountry(province, "Yunnan Country", false);

            // 4) Adds more provinces from the pool to the new country
            province = map.GetProvince("Guangxi", "Pool");
            map.CountryTransferProvinceRegion(yunnanCountryIndex, province.mainRegion, false);
            province = map.GetProvince("Guizhou", "Pool");
            map.CountryTransferProvinceRegion(yunnanCountryIndex, province.mainRegion, false);
            province = map.GetProvince("Sichuan", "Pool");
            map.CountryTransferProvinceRegion(yunnanCountryIndex, province.mainRegion, false);

            // 5) Refresh map and frontiers
            map.drawAllProvinces = true;
            map.Redraw(true);

            // 6) Add province names
            map.DrawProvinceLabels(yunnanCountryIndex);

            // 7) Fly to country and fit zoom
            float zoomLevel = map.GetCountryRegionZoomExtents(yunnanCountryIndex);

            map.FlyToCountry(yunnanCountryIndex, 2f, zoomLevel);
        }