DaoJiShi.cs 607 B

1234567891011121314151617181920212223242526
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. using XRTool.Util;
  6. public class DaoJiShi : MonoBehaviour
  7. {
  8. int Count = 30;
  9. Timer t;
  10. private void OnEnable()
  11. {
  12. if(TimerMgr.Instance)
  13. {
  14. TimerMgr.Instance.DestroyTimer(t);
  15. Count = 30;
  16. this.GetComponent<TextMeshProUGUI>().text = Count.ToString();
  17. t = TimerMgr.Instance.CreateTimer(() => {
  18. Count--;
  19. this.GetComponent<TextMeshProUGUI>().text = Count.ToString();
  20. }, 0.1f, 30);
  21. }
  22. }
  23. }