Exemple #1
0
        private void OnMapClick()
        {
            control.GetCoords(out targetLng, out targetLat);

            if (targetMarker == null)
            {
                targetMarker       = OnlineMapsMarker3DManager.CreateItem(targetLng, targetLat, targetPrefab);
                targetMarker.scale = targetScale;
            }
            else
            {
                targetMarker.SetPosition(targetLng, targetLat);
            }

            double tx1, ty1, tx2, ty2;

            map.projection.CoordinatesToTile(lng, lat, map.zoom, out tx1, out ty1);
            map.projection.CoordinatesToTile(targetLng, targetLat, map.zoom, out tx2, out ty2);

            rotation = (float)OnlineMapsUtils.Angle2D(tx1, ty1, tx2, ty2) - 90;

            if (!OnlineMapsKeyManager.hasGoogleMaps)
            {
                Debug.LogWarning("Please enter Map / Key Manager / Google Maps");
                return;
            }

            OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections(OnlineMapsKeyManager.GoogleMaps(), new Vector2((float)lng, (float)lat), control.GetCoords());

            request.OnComplete += OnRequestComplete;
            request.Send();
        }
Exemple #2
0
    public void PrintTheRoute(string End)
    {
        OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections("AIzaSyDgAoQ2SBb8nvf3vtFC5UAqkA6WA1Xijho", OnlineMapsLocationService.instance.position, End);

        Debug.Log(request);
        request.OnComplete += OnRequestDone;
        request.Send();
    }
        private void Start()
        {
            if (string.IsNullOrEmpty(googleAPIKey)) Debug.LogWarning("Please specify Google API Key");

            // Find route using Google Directions API
            OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections(googleAPIKey, "Los Angeles", new Vector2(-118.178960f, 35.063995f));
            request.OnComplete += OnGoogleDirectionsComplete;
            request.Send();
        }
        private void Start()
        {
            if (string.IsNullOrEmpty(googleAPIKey))
            {
                Debug.LogWarning("Please specify Google API Key");
            }

            // Looking for a route between locations.
            OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections(googleAPIKey, fromPlace, toPlace);

            request.OnComplete += OnComplete;
            request.Send();
        }
        private void Start()
        {
            if (string.IsNullOrEmpty(googleAPIKey))
            {
                Debug.LogWarning("Please specify Google API Key");
            }

            // Begin to search a route from Los Angeles to the specified coordinates.
            OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections
                                                 (
                googleAPIKey,
                "Los Angeles",                        // FROM (string or Vector2)
                new Vector2(-118.178960f, 35.063995f) // TO (string or Vector2)
                                                 );

            // Specifies that search results must be sent to OnFindDirectionComplete.
            request.OnComplete += OnFindDirectionComplete;

            request.Send();
        }