using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class TimerBehavior : MonoBehaviour
{

    public float TimePlayed;

    void Start()
    {
        
    }


    void Update()
    {
        TimePlayed += Time.deltaTime;
        var span = TimeSpan.FromSeconds(TimePlayed);
        string text;
        if (span.Hours > 0)
            text = string.Format("{0:D2}:{1:D2}:{2:D2}", span.Hours, span.Minutes, span.Seconds);
        else
            text = string.Format("{0:D2}:{1:D2}", span.Minutes, span.Seconds);
        transform.Find("Timer Text").GetComponent<TextMeshProUGUI>().text = text;
    }

}
