public class Timercontroler : MonoBehaviour {
public Text timer;
float timeleft=300f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
timeleft -= Time.deltaTime;
int minute = Mathf.FloorToInt (timeleft / 60f);
int second = Mathf.FloorToInt (timeleft -minute*60);
timer.text = minute.ToString()+":"+second.ToString();
}
}
↧