先写一个静态类:
/// <summary> /// 公用基础函数库 /// <remarks>作者: YangYxd</remarks> /// </summary> public static class Common { /// <summary> /// 返回一个以毫秒为单位的时间 (0001-01-01 00:00:00.000 算起) /// </summary> public static long Ticks { get { return (long) (System.DateTime.UtcNow.Ticks * 0.0001f) ; } } public delegate bool CondDelegate(); /// <summary> /// 等待指定的毫秒 /// </summary> public static IEnumerator WaitForMillis(long millis, CondDelegate cond = null) { } }
调用方法:
yield return Common.WaitForMillis (5000);