using Godot;
using Mr.BrickAdventures;
using Mr.BrickAdventures.Autoloads;

namespace Mr.BrickAdventures.scripts.UI;

[GlobalClass]
public partial class SpeedRunHud : Control
{
    [Export] private Label _timerLabel;

    public override void _Ready()
    {
        SpeedRunManager.Instance.TimeUpdated += OnTimerUpdated;
    }

    private void OnTimerUpdated(double totalTime, double levelTime)
    {
        _timerLabel.Text = SpeedRunManager.FormatTime(totalTime);
    }
}