// Sample code to show how to:
        // 1.- Navigate and center a country in the map
        // 2.- Add a blink effect to one country (can be used on any number of countries)
        void FlyToCountry(string countryName)
        {
            int countryIndex = map.GetCountryIndex(countryName);

            map.FlyToCountry(countryIndex);
            map.BlinkCountry(countryIndex, Color.black, Color.green, 4, 0.2f);
        }
Exemplo n.º 2
0
        // Sample code to show how to:
        // 1.- Navigate and center a country in the map
        // 2.- Add a blink effect to one country (can be used on any number of countries)
        void FlyToCountry(string countryName)
        {
            int   countryIndex = map.GetCountryIndex(countryName);
            float zoomLevel    = map.GetCountryMainRegionZoomExtents(countryIndex);

            map.FlyToCountry(countryIndex, 2f, zoomLevel, 0.5f);
            map.BlinkCountry(countryIndex, Color.black, Color.green, 4, 2.5f, true);
        }
Exemplo n.º 3
0
        public void MergeProvincesInCountry(Country country, bool[] provinceSettings)
        {
            if (!started)
            {
                Start();
            }

            int countryIndex = worldMapGlobe.GetCountryIndex(country.name);

            Province[] countryProvinces = worldMapGlobe.countries[countryIndex].provinces;
            if (countryIndex < 0 || countryProvinces == null)
            {
                errorHandler.ReportError("Attempted to merge invalid provinces in invalid country", ErrorState.close_window);
                return;
            }

            //Get all provinces for country and loop through them
            List <Province> countryProvinceList = countryProvinces.ToList();
            List <Province> removedProvinces    = new List <Province>();
            Province        province;

            for (int i = 0; i < countryProvinceList.Count; i++)
            {
                //Get province attributes
                province         = countryProvinceList[i];
                removedProvinces = MergeProvinceWithNeighbors(province, provinceSettings, false);
                if (removedProvinces.Count > 0)
                {
                    foreach (Province removedProvince in removedProvinces)
                    {
                        countryProvinceList.Remove(removedProvince);
                    }
                }
            }
        }
Exemplo n.º 4
0
        // Use this for initialization
        void Start()
        {
            WorldMapGlobe map = WorldMapGlobe.instance;

            // Gets France center in sphere coordinates
            int     countryIndex  = map.GetCountryIndex("France");
            Vector3 countryCenter = map.countries[countryIndex].sphereCenter;

            // Center on France and set constraint around country center
            map.FlyToLocation(countryCenter, 0);
            map.constraintPosition        = countryCenter;
            map.constraintAngle           = 5f;
            map.constraintPositionEnabled = true;

            // Set zoom level and stop rotation
            map.SetZoomLevel(0.1f);
            map.autoRotationSpeed = 0f;
        }
Exemplo n.º 5
0
        public void IntantiateMappables(Country country)
        {
            if (!started)
            {
                Start();
            }

            List <MountPoint> countryMountPoints = new List <MountPoint>();

            try
            {
                int countryIndex    = worldMapGlobe.GetCountryIndex(country.name);
                int mountPointCount = worldMapGlobe.GetMountPoints(countryIndex, countryMountPoints);
            }
            catch
            {
                errorHandler.ReportError("Failed to load country's mount points", ErrorState.restart_scene);
                return;
            }

            foreach (MountPoint mountPoint in countryMountPoints)
            {
                if (mountPoint.type == START_POINT && mountPoint.provinceIndex == worldMapGlobe.GetProvinceIndex(startingCountry, startingProvince))
                {
                    int startingCellIndex = worldMapGlobe.GetCellIndex(mountPoint.localPosition);
                    if (startingCellIndex < 0 || startingCellIndex > worldMapGlobe.cells.Length)
                    {
                        errorHandler.ReportError("Invalid starting mount point", ErrorState.restart_scene);
                    }
                    else
                    {
                        Cell startingCell       = worldMapGlobe.cells[startingCellIndex];
                        bool playerInstantiated = playerManager.IntantiatePlayer(startingCell);
                    }
                }
                if (mountPoint.type == CULTURAL_POINT) //&& loadedMapSettings.culturalLandmarks)
                {
                    LandmarkManager.InstantiateCulturalLandmark(mountPoint);
                }
            }
        }