-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
47 lines (43 loc) · 1.27 KB
/
Program.cs
File metadata and controls
47 lines (43 loc) · 1.27 KB
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
using System;
using System.Collections;
using System.Threading;
namespace Coroutine
{
class Program
{
static void Main(string[] args)
{
var engine = new CoroutineEngine();
engine.StartCoroutine(TestNull());
engine.StartCoroutine(TestWaitUntil());
while (true)
{
engine.Update();
engine.CoroutineUpdate();
Thread.Sleep(33);
}
}
static bool condition = false;
static IEnumerator TestNull()
{
Debug.Log("Test Null", "1");
yield return null;
Debug.Log("Test Null", "2");
yield return TestWaitForSeconds();
}
static IEnumerator TestWaitForSeconds()
{
Debug.Log("TestWaitForSeconds", "start WaitForSeconds");
yield return new WaitForSeconds(5);
condition = true;
Debug.Log("TestWaitForSeconds", "stop WaitForSeconds");
yield return 2;
}
static IEnumerator TestWaitUntil()
{
Debug.Log("TestWaitUntil", "start WaitUntil");
yield return new WaitUntil(() => condition);
Debug.Log("TestWaitUntil", "stop WaitUntil");
}
}
}