forked from dongweiPeng/SkillSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTask.cs
More file actions
40 lines (34 loc) · 1.18 KB
/
Copy pathTestTask.cs
File metadata and controls
40 lines (34 loc) · 1.18 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Task;
public class TestTask : MonoBehaviour {
Queue<Task.Task> taskQueue = new Queue<Task.Task>();
public Button btn;
Task.Task curTask;
IEnumerator Start () {
Task.Task task1 = new Task.Task("第一个任务 时间任务,间隔两秒", new TimeCondition(1.0f));
TaskManager.Instance().AddTask(task1);
Task.Task task2 = new Task.Task("第二个任务 次数任务,3", new TimesCondition(3));
Task.Task task3 = new Task.Task("第三个任务 点击按钮", new TirggerCondition(btn));
TaskManager.Instance().AddTask(task2);
TaskManager.Instance().AddTask(task3);
curTask = TaskManager.Instance().Next();
while (curTask!=null)
{
yield return curTask;
Debug.Log(curTask.m_Name + " 已经做完了");
curTask = TaskManager.Instance().Next();
}
}
// Update is called once per frame
void Update () {
}
private void OnGUI()
{
if (GUI.Button(new Rect(0, 0, 100, 100), "click")) {
curTask.Condition.Handle();
}
}
}