LoadingView.cs 609 B

12345678910111213141516171819202122232425
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class LoadingView : MonoBehaviour {
  5. private UnityEngine.UI.Text mText;
  6. private float shengyushijian;
  7. private void Awake()
  8. {
  9. mText = this.GetComponentInChildren<UnityEngine.UI.Text>();
  10. }
  11. private void OnEnable()
  12. {
  13. shengyushijian = 3f;
  14. }
  15. // Update is called once per frame
  16. void Update () {
  17. shengyushijian -= Time.deltaTime;
  18. if(mText != null)
  19. mText.text = ""+ Mathf.Floor(Mathf.Max(0, shengyushijian));
  20. }
  21. }