using Engine.Scene.Component.BuiltIn.Renderer;

namespace DoomDeathmatch.Component.MVC.View;

public class TimerView : Engine.Scene.Component.Component
{
  private readonly TextRenderer _timerTextRenderer;

  public TimerView(TextRenderer parTimerTextRenderer)
  {
    _timerTextRenderer = parTimerTextRenderer;
  }

  public void UpdateView(double parTime)
  {
    var seconds = Math.Floor(parTime) % 60;
    var minutes = Math.Floor(parTime / 60) % 60;

    _timerTextRenderer.Text = $"Время: {minutes:00}:{seconds:00}";
  }
}