[TASK] Initial commit with basic product setup
This commit is contained in:
55
Assets/Mapbox SDK/Mapbox/Examples/Scripts/LocationStatus.cs
Normal file
55
Assets/Mapbox SDK/Mapbox/Examples/Scripts/LocationStatus.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
namespace Mapbox.Examples
|
||||
{
|
||||
using Mapbox.Unity.Location;
|
||||
using Mapbox.Utils;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LocationStatus : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
Text _statusText;
|
||||
|
||||
private AbstractLocationProvider _locationProvider = null;
|
||||
void Start()
|
||||
{
|
||||
if (null == _locationProvider)
|
||||
{
|
||||
_locationProvider = LocationProviderFactory.Instance.DefaultLocationProvider as AbstractLocationProvider;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
Location currLoc = _locationProvider.CurrentLocation;
|
||||
|
||||
if (currLoc.IsLocationServiceInitializing)
|
||||
{
|
||||
_statusText.text = "location services are initializing";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currLoc.IsLocationServiceEnabled)
|
||||
{
|
||||
_statusText.text = "location services not enabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currLoc.LatitudeLongitude.Equals(Vector2d.zero))
|
||||
{
|
||||
_statusText.text = "Waiting for location ....";
|
||||
}
|
||||
else
|
||||
{
|
||||
_statusText.text = string.Format("{0}", currLoc.LatitudeLongitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user