-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYielders.cs
More file actions
27 lines (22 loc) · 752 Bytes
/
Yielders.cs
File metadata and controls
27 lines (22 loc) · 752 Bytes
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
using UnityEngine;
using System.Collections.Generic;
public static class Yielders
{
static Dictionary<float, WaitForSeconds> _timeInterval = new Dictionary<float, WaitForSeconds>(100);
static WaitForEndOfFrame _endOfFrame = new WaitForEndOfFrame();
public static WaitForEndOfFrame EndOfFrame
{
get { return _endOfFrame; }
}
static WaitForFixedUpdate _fixedUpdate = new WaitForFixedUpdate();
public static WaitForFixedUpdate FixedUpdate
{
get { return _fixedUpdate; }
}
public static WaitForSeconds Get(float seconds)
{
if (!_timeInterval.ContainsKey(seconds))
_timeInterval.Add(seconds, new WaitForSeconds(seconds));
return _timeInterval[seconds];
}
}