using TMPro;
using UnityEngine;

public class UIManager : MonoBehaviour
{
    [SerializeField] private TMP_Text AltitudeText;
    [SerializeField] private TMP_Text JumpText;
    [SerializeField] private TMP_Text SanityText;
    [SerializeField] private TMP_Text UploadText;

    [SerializeField] private GameObject Norma;
    [SerializeField] private GameObject Ship;
    [SerializeField] private GameObject Player;

    private float uploadStatus;
    private float heightStatus;
    private float sanityStatus;

    // Start is called before the first frame update
    void Start()
    {
        JumpText.text = "";
    }

    // Update is called once per frame
    void Update()
    {
        UpdateData();
        UpdateTexts();
    }

    void UpdateData()
    {
        heightStatus = Ship.GetComponent<ShipLogic>().getcurrentAltitude();

        sanityStatus = Player.GetComponent<PlayerLogic>().getSanityStatus();

        uploadStatus = Norma.GetComponent<NormaLogic>().GetUploadStatus();

    }

    void UpdateTexts()
    {

        AltitudeText.text = "Altitude: " + heightStatus + "m";
        SanityText.text = "Sanity: " + sanityStatus;
        UploadText.text = "Upload: " + uploadStatus + "%";

    }
}
