示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        // Input.location.Start();

        // if (Input.location.status == LocationServiceStatus.Failed)
        // {
        //     print("Unable to determine device location");
        //     yield break;
        // }
        // else
        // {
        //     // Access granted and location value could be retrieved
        //     print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
        // }

        // int maxWait = 20;
        // while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        // {
        //     yield return new WaitForSeconds(1);
        //     maxWait--;
        // }

        // // Service didn't initialize in 20 seconds
        // if (maxWait < 1)
        // {
        //     print("Timed out");
        //     yield break;
        // }

        // var locationInfo = Input.location.lastData;

        // Input.location.Stop();

        var location = new Map.LocationCoordinate2D(-37.5672953, 143.7827009);

#if !UNITY_EDITOR && UNITY_IOS
        var span = new Map.CoordinateSpan(.01, .01);

        var options = new Map.AppleMapOptions();
        options.Region(new Map.CoordinateRegion(location, span))
        .MapType(Map.MapViewType.Standard)
        .ScrollEnabled(true)
        .RotateEnabled(true)
        .ZoomEnabled(true)
        .PitchEnabled(true)
        .ShowBuildings(true)
        .ShowCompass(true)
        .ShowPointsOfInterest(true)
        .ShowScale(true)
        .ShowTraffic(true);
        _map = new Map.AppleMapsView(options);
        // _map.SetOnPinSelectedListener(HandleOnPinSelected);
        _map.Show(RectTransformToScreenSpace(mapTransform));

        AddTrashPins();
#endif
    }
示例#2
0
 public CoordinateRegion(LocationCoordinate2D location, CoordinateSpan coordinateSpan)
 {
     _location       = location;
     _coordinateSpan = coordinateSpan;
 }