Text_PauseCounter.cs 846 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using UnityEngine;
  2. using System.Collections;
  3. public class Text_PauseCounter : MonoBehaviour
  4. {
  5. private static Text_PauseCounter _instance;
  6. [SerializeField]
  7. private UILabel countdown;
  8. private void Start()
  9. {
  10. _instance = this;
  11. }
  12. public static void Show()
  13. {
  14. if (_instance)
  15. {
  16. _instance.StartCoroutine(_instance.ShowRoutine());
  17. }
  18. }
  19. private IEnumerator ShowRoutine()
  20. {
  21. InGameScriptCS.Instance.Pause();
  22. countdown.gameObject.SetActive(true);
  23. for (int i = 3; i > 0; i--)
  24. {
  25. countdown.text = i.ToString();
  26. yield return new WaitForSeconds(1);
  27. }
  28. countdown.gameObject.SetActive(false);
  29. InGameScriptCS.Instance.Resume();
  30. //InGameScriptCS.Instance.InvokeResurrection();
  31. }
  32. }