[TASK] Added content + camera controller
This commit is contained in:
44
Assets/GoldDuckEditorLocationProvider.cs
Normal file
44
Assets/GoldDuckEditorLocationProvider.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Mapbox.Unity.Location;
|
||||
using Mapbox.Unity.Utilities;
|
||||
using Mapbox.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
public class GoldDuckEditorLocationProvider : AbstractEditorLocationProvider
|
||||
{
|
||||
[SerializeField] CollectableDuckData[] _ducks;
|
||||
|
||||
[SerializeField]
|
||||
Vector2d _latitudeOffset = new Vector2d(0.0001, 0);
|
||||
|
||||
/// The mock heading value.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Range(0, 359)]
|
||||
float _heading;
|
||||
|
||||
|
||||
private int idx = -1;
|
||||
Vector2d LatitudeLongitude
|
||||
{
|
||||
get
|
||||
{
|
||||
idx++;
|
||||
// reset index to keep looping through the location array
|
||||
if (idx >= _ducks.Length) { idx = 0; }
|
||||
return _ducks[idx].LatitudeLongitude + _latitudeOffset;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetLocation()
|
||||
{
|
||||
_currentLocation.UserHeading = _heading;
|
||||
_currentLocation.LatitudeLongitude = LatitudeLongitude;
|
||||
_currentLocation.Accuracy = _accuracy;
|
||||
_currentLocation.Timestamp = UnixTimestampUtils.To(DateTime.UtcNow);
|
||||
_currentLocation.IsLocationUpdated = true;
|
||||
_currentLocation.IsUserHeadingUpdated = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user