using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Timer : MonoBehaviour
{
    Text label;
    CubeSpawn global;

    // Start is called before the first frame update
    void Start()
    {
        label = gameObject.GetComponent<Text>();
        global = (CubeSpawn)FindObjectOfType(typeof(CubeSpawn));
    }

    // Update is called once per frame
    void Update()
    {
        TimeSpan span = TimeSpan.FromSeconds(global.GameTime());
        label.text = string.Format("{0:0}:{1:00}.{2:0}", span.Minutes, span.Seconds, span.Milliseconds/100);
    }
}
