33 lines
817 B
C#
33 lines
817 B
C#
using Mapbox.Unity.Map;
|
|
using UnityEngine;
|
|
|
|
namespace Assets.Scenes.Ride.Scripts
|
|
{
|
|
public class MiniMapPlayerController: MonoBehaviour
|
|
{
|
|
private AbstractPlayer _player;
|
|
private AbstractMap _map;
|
|
private void Awake()
|
|
{
|
|
_map = transform.parent.Find("MiniMap").GetComponent<AbstractMap>();
|
|
}
|
|
public void SetController(AbstractPlayer player)
|
|
{
|
|
_player = player;
|
|
}
|
|
float t = 1f;
|
|
private void Update()
|
|
{
|
|
t -= Time.deltaTime;
|
|
while (t < 0)
|
|
{
|
|
if (_player != null)
|
|
{
|
|
transform.localPosition = _map.GeoToWorldPosition(_player.Currentlatlong);
|
|
}
|
|
t = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|