[TASK] Initial commit with basic product setup

This commit is contained in:
2019-08-18 13:50:14 +02:00
commit 01a66a8e1f
2548 changed files with 167528 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
namespace Mapbox.Unity.Location
{
using System.Collections;
using UnityEngine;
public abstract class AbstractEditorLocationProvider : AbstractLocationProvider
{
[SerializeField]
protected int _accuracy;
[SerializeField]
bool _autoFireEvent;
[SerializeField]
float _updateInterval;
[SerializeField]
bool _sendEvent;
WaitForSeconds _wait = new WaitForSeconds(0);
#if UNITY_EDITOR
protected virtual void Awake()
{
_wait = new WaitForSeconds(_updateInterval);
StartCoroutine(QueryLocation());
}
#endif
IEnumerator QueryLocation()
{
// HACK: Let others register before we send our first event.
// Often this happens in Start.
yield return new WaitForSeconds(.1f);
while (true)
{
SetLocation();
if (_autoFireEvent)
{
SendLocation(_currentLocation);
}
yield return _wait;
}
}
// Added to support TouchCamera script.
public void SendLocationEvent()
{
SetLocation();
SendLocation(_currentLocation);
}
protected virtual void OnValidate()
{
if (_sendEvent)
{
_sendEvent = false;
SendLocation(_currentLocation);
}
}
protected abstract void SetLocation();
}
}