Code Block - Step
Code Block - Step
๐ซ Step
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
public enum SomeStep
{
None = 0,
Step1 = 1,
Step2 = 2,
Step3 = 3,
Step4 = 4,
Step5 = 5,
}
public class SomeClass : MonoBehaviour
{
private SomeStep step = SomeStep.None;
public void SetStep(SomeStep newStep)
{
step = newStep;
}
private IEnumerator WaitForStep(SomeStep targetStep)
{
do yield return null;
while (step != targetStep);
}
public void SomeMethod()
{
while (true)
{
// Do something
Debug.Log("Doing something...");
// Wait for step 3
yield return StartCoroutine(WaitForStep(SomeStep.Step3));
// Do something else
Debug.Log("Doing something else...");
// Wait for step 5
yield return StartCoroutine(WaitForStep(SomeStep.Step5));
}
}
}
์ด ๊ธฐ์ฌ๋ ์ ์๊ถ์์ CC BY 4.0 ๋ผ์ด์ผ์ค๋ฅผ ๋ฐ๋ฆ
๋๋ค.