You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.6 KiB

  1. using UnityEngine;
  2. using System.Collections;
  3. public class CDscript : MonoBehaviour {
  4. public bool pause = true;
  5. public float startCount = 5.0f;
  6. public GameObject num1;
  7. public GameObject num2;
  8. public GameObject num3;
  9. public GameObject num4;
  10. public GameObject num5;
  11. // Use this for initialization
  12. void Start () {
  13. pause = true;
  14. }
  15. // Update is called once per frame
  16. void Update () {
  17. if (pause){
  18. startCount -= Time.unscaledDeltaTime;
  19. Time.timeScale = 0;
  20. Debug.Log ("cd");
  21. }
  22. if (startCount >=4.0f && startCount <= 4.9f){
  23. num5.SetActive(true);
  24. num4.SetActive(false);
  25. num3.SetActive(false);
  26. num2.SetActive(false);
  27. num1.SetActive(false);
  28. }
  29. if (startCount >=3.0f && startCount <= 3.9f){
  30. num5.SetActive(false);
  31. num4.SetActive(true);
  32. num3.SetActive(false);
  33. num2.SetActive(false);
  34. num1.SetActive(false);
  35. }
  36. if (startCount >=2.0f && startCount <= 2.9f){
  37. num5.SetActive(false);
  38. num4.SetActive(false);
  39. num3.SetActive(true);
  40. num2.SetActive(false);
  41. num1.SetActive(false);
  42. }
  43. if (startCount >=1.0f && startCount <= 1.9f){
  44. num5.SetActive(false);
  45. num4.SetActive(false);
  46. num3.SetActive(false);
  47. num2.SetActive(true);
  48. num1.SetActive(false);
  49. }
  50. if (startCount >=0.0f && startCount <= 0.9f){
  51. num5.SetActive(false);
  52. num4.SetActive(false);
  53. num3.SetActive(false);
  54. num2.SetActive(false);
  55. num1.SetActive(true);
  56. }
  57. if (startCount <=0){
  58. num5.SetActive(false);
  59. num4.SetActive(false);
  60. num3.SetActive(false);
  61. num2.SetActive(false);
  62. num1.SetActive(false);
  63. pause = false;
  64. Time.timeScale = 1;
  65. startCount = startCount + 5.0f;
  66. }
  67. }
  68. }