using TMPro;
using UnityEngine;

[RequireComponent(typeof(TextMeshProUGUI))]
public class DistanceTracker : MonoBehaviour
{
    TextMeshProUGUI _textComponent;

    private void Awake()
    {
        _textComponent = GetComponent<TextMeshProUGUI>();
    }

    private void Update()
    {
        _textComponent.text = string.Format("Distance from {0} is {1:00.00}m", FirstPersonController.Instance.GravityBody.CurrentPlanet.name, FirstPersonController.Instance.GravityBody.DistanceFromPlanet);
    }
}
