-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTest.cs
More file actions
43 lines (39 loc) · 1.15 KB
/
Copy pathTest.cs
File metadata and controls
43 lines (39 loc) · 1.15 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
/*********************************************************
文件:Test
作者:Administrator
邮箱:630276388@qq.com
日期:2020/8/23 13:44:57
功能:待定
***********************************************************/
using BJTimer;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour
{
private TimerSystem timeSys;
private Queue<IDPack> queue = new Queue<IDPack>();
private float timer;
// Start is called before the first frame update
void Start()
{
timeSys = TimerSystem.Instance;
timeSys.Init();
}
private void Update()
{
timer += Time.deltaTime;
IDPack id = timeSys.AddTimerTask((tid) => { int a = 500 + 500; }, 500, 5);
queue.Enqueue(id);
if(timer > 1f)
{
timer = 0f;
int rand = Random.Range(0, queue.Count / 2);
for(int i = 0; i < rand; i++)
{
IDPack tid = queue.Dequeue();
if(tid.type == TaskType.TimeTask) timeSys.DeleteTimeTask(tid.id);
}
}
}
}