-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAfterMinutes.cs
134 lines (99 loc) · 2.58 KB
/
AfterMinutes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AfterMinutes : MonoBehaviour
{
public GameObject bad;
public GameObject good;
public GameObject mom;
public GameObject guideline;
public GameObject text1;
public GameObject text2;
public GameObject next;
public Image gauge;
public int t1;
DateTime dt1;
DateTime dt2;
void Start()
{
bad.SetActive(true);
good.SetActive(false);
mom.SetActive(false);
guideline.SetActive(false);
text1.SetActive(false);
text2.SetActive(false);
next.SetActive(false);
gauge.enabled = (false);
LetsCheckAgain();//시작시간 체크
StartCoroutine(WaitForIt(2.0f));
}
void Update()
{
}
IEnumerator WaitForIt(float time)
{
bool result = TimeSpans();
if (result == true)
{
yield return new WaitForSeconds(2);
Debug.Log(result);
GuideLine();
yield return new WaitForSeconds(1);
NextGuideLine();
yield return new WaitForSeconds(1);
Final();
}
else
{
Debug.Log("s");
}
}
private void LetsCheck()
{
Debug.Log("종료 시간 : " + System.DateTime.Now.ToString());
dt1 = System.DateTime.Now;
PlayerPrefs.SetInt("lasttime", dt1.Minute);
}
private void LetsCheckAgain()
{
Debug.Log("재시작 시간 : " + System.DateTime.Now.ToString());
dt2 = System.DateTime.Now;
}
private bool TimeSpans()
{
int lasttime = PlayerPrefs.GetInt("lasttime");
int t1= dt2.Minute - lasttime;
Debug.Log(dt2.Minute);
Debug.Log(lasttime);
if (t1 >= 1)
{
bad.SetActive(false);
good.SetActive(true);
gauge.fillAmount = 0.3f;
return true;
}
return false;
}
private void GuideLine()
{
mom.SetActive(true);
guideline.SetActive(true);
text1.SetActive(true);
Debug.Log("gogo");
}
private void NextGuideLine()
{
text1.SetActive(false);
text2.SetActive(true);
}
private void Final()
{
next.SetActive(true);
}
private void OnApplicationQuit()
{
LetsCheck();//종료시간 체크
}
}