コード例 #1
0
        public static void AddTo(GameObject marker, float duration, float speed)
        {
            MarkerBlinker mb = marker.AddComponent <MarkerBlinker> ();

            mb.duration = duration;
            mb.speed    = speed;
        }
コード例 #2
0
        /// <summary>
        /// Illustrates how to add custom markers over the globe using the AddMarker API.
        /// In this example a building prefab is added to a random city (see comments for other options).
        /// </summary>
        void AddMarkerGameObjectOnRandomCity()
        {
            // Every marker is put on a spherical-coordinate (assuming a radius = 0.5 and relative center at zero position)
            Vector3 sphereLocation;

            // Add a marker on a random city
            City city = map.cities [Random.Range(0, map.cities.Count)];

            sphereLocation = city.unitySphereLocation;

            // or... choose a city by its name:
            //		int cityIndex = map.GetCityIndex("Moscow");
            //		sphereLocation = map.cities[cityIndex].unitySphereLocation;

            // or... use the centroid of a country
            //		int countryIndex = map.GetCountryIndex("Greece");
            //		sphereLocation = map.countries[countryIndex].center;

            // Send the prefab to the AddMarker API setting a scale of 0.02f (this depends on your marker scales)
            GameObject building = Instantiate(Resources.Load <GameObject> ("Building/Building"));

            map.AddMarker(building, sphereLocation, 0.02f);


            // Fly to the destination and see the building created
            map.FlyToLocation(sphereLocation);

            // Optionally add a blinking effect to the marker
            MarkerBlinker.AddTo(building, 4, 0.2f);
        }
コード例 #3
0
        /// <summary>
        /// Illustrates how to add custom markers over the globe using the AddMarker API.
        /// In this example a building prefab is added to a random city (see comments for other options).
        /// </summary>
        void AddMarkerGameObjectOnRandomCity()
        {
            // Every marker is put on a spherical-coordinate (assuming a radius = 0.5 and relative center at zero position)
            Vector3 sphereLocation;

            // Add a marker on a random city
            City city = map.cities [Random.Range(0, map.cities.Count)];

            sphereLocation = city.unitySphereLocation;
            //Debug.Log("CITY sphereical coords: " + sphereLocation);

            // or... choose a city by its name:
//		int cityIndex = map.GetCityIndex("Moscow");
//		sphereLocation = map.cities[cityIndex].unitySphereLocation;

            // or... use the centroid of a country
//		int countryIndex = map.GetCountryIndex("Greece");
//		sphereLocation = map.countries[countryIndex].center;

            // or... use a custom location lat/lon. Example put the building over New York:
//		map.calc.fromLatDec = 40.71f;	// 40.71 decimal degrees north
//		map.calc.fromLonDec = -74.00f;	// 74.00 decimal degrees to the west
//		map.calc.fromUnit = UNIT_TYPE.DecimalDegrees;
//		map.calc.Convert();
//		sphereLocation = map.calc.toSphereLocation;

            // Send the prefab to the AddMarker API setting a scale of 0.02f (this depends on your marker scales)
            GameObject building = Instantiate(Resources.Load <GameObject> ("Building/Building"));

            map.AddMarker(building, sphereLocation, 0.02f);


            // Fly to the destination and see the building created
            map.FlyToLocation(sphereLocation);

            // Optionally add a blinking effect to the marker
            MarkerBlinker.AddTo(building, 4, 0.2f);
        }