[TASK] Spawn collectable ducks on the map when in range
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Mapbox.Unity.Utilities;
|
||||
using Mapbox.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
@@ -13,7 +16,27 @@ public class CollectableDuckData: ScriptableObject
|
||||
|
||||
[FormerlySerializedAs("_sticker")] [SerializeField] private DuckStickerData stickerData;
|
||||
|
||||
public string LatitudeLongitude => _latitudeLongitude;
|
||||
public Vector2d LatitudeLongitude
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_latitudeLongitude))
|
||||
{
|
||||
return Vector2d.zero;
|
||||
}
|
||||
|
||||
var splitIndex = _latitudeLongitude.IndexOf(",", StringComparison.Ordinal);
|
||||
if (splitIndex < 0)
|
||||
{
|
||||
throw new Exception("Invalid Duck coordinate: " + _latitudeLongitude);
|
||||
}
|
||||
|
||||
var lat = double.Parse(_latitudeLongitude.Substring(0, splitIndex), NumberStyles.Float, CultureInfo.InvariantCulture);
|
||||
var lon = double.Parse(_latitudeLongitude.Substring(splitIndex + 1), NumberStyles.Float, CultureInfo.InvariantCulture);
|
||||
|
||||
return new Vector2d(lat, lon);
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject ModelPrefab => _modelPrefab;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user