void NewPath()
        {
            // Create a path consisting of a list of latitude/longitudes
            const int      numLocations = 20;
            List <Vector2> latLonList   = new List <Vector2>(numLocations);

            // Starting city - calling GetCityIndex without parameters returns a random visible city index
            int cityIndex = map.GetCityIndex();

            Debug.Log("Path started on " + map.cities[cityIndex].fullName);

            // Add the city lat/lon coordinates to the list
            latLonList.Add(map.cities[cityIndex].latlon);

            // Add more cities - we'll take the 20 nearest cities
            List <int> excludeList = new List <int>(numLocations);

            excludeList.Add(cityIndex);

            for (int k = 1; k < numLocations; k++)
            {
                // Get the nearest city
                cityIndex = map.GetCityIndex(map.cities[cityIndex].latlon, excludeList);
                excludeList.Add(cityIndex);
                latLonList.Add(map.cities[cityIndex].latlon);
            }

            // Create the moving gameobject
            if (anim != null)
            {
                Destroy(anim.gameObject);
            }
            GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Sphere);

            obj.transform.localScale = Vector3.one * 0.1f;
            obj.GetComponent <Renderer>().material.color = Color.yellow;

            // Add a GlobePos animator
            anim        = obj.AddComponent <GlobePosAnimator>();
            anim.latLon = latLonList;

            // Refresh path
            anim.DrawPath();

            // Update current position
            anim.MoveTo(progress);
        }
Exemplo n.º 2
0
        void StartPlague()
        {
            rtVirusMap.Clear(false, true, Misc.ColorTransparent);

            // Get a random city
            int cityRandom = Random.Range(0, map.cities.Count);

            cityRandom = map.GetCityIndex("Spain", "Madrid", "Madrid");
            Vector2 pointZero = map.cities [cityRandom].latlon;

            StartCoroutine(Spread(cityRandom));
        }
Exemplo n.º 3
0
        // Sample code to show how to navigate to a city:
        void FlyToCity(string cityName)
        {
            int cityIndex = map.GetCityIndex(cityName);

            map.FlyToCity(cityIndex, 1f, 0.2f, 0.1f);
        }