コード例 #1
0
 /// <summary>
 /// 设置间隔
 /// </summary>
 /// <param name="targetGo">需要绑定此脚本的对象</param>
 /// <param name="millisecond">毫秒数</param>
 /// <param name="delayCompleteHandler">回调</param>
 /// <param name="autoDestroy">是否在结束时销毁脚本</param>
 /// <param name="param">需要在回调函数中获取的参数</param>
 /// <returns></returns>
 public static void setDelay(GameObject targetGo, 
                             float millisecond, 
                             DelayCompleteHandler delayCompleteHandler, 
                             bool autoDestroy = true, 
                             System.Object param = null)
 {
     if (targetGo == null) return;
     Delay.delay = targetGo.GetComponent<Delay>();
     if (Delay.delay == null) Delay.delay = targetGo.AddComponent<Delay>();
     Delay.isComplete = false;
     Delay.millisecond = millisecond;
     Delay.delayCompleteHandler = delayCompleteHandler;
     Delay.autoDestroy = autoDestroy;
     Delay.param = param;
 }
コード例 #2
0
 /// <summary>
 /// 设置间隔
 /// </summary>
 /// <param name="targetGo">需要绑定此脚本的对象</param>
 /// <param name="millisecond">毫秒数</param>
 /// <param name="delayCompleteHandler">回调</param>
 /// <param name="autoDestroy">是否在结束时销毁脚本</param>
 /// <param name="param">需要在回调函数中获取的参数</param>
 /// <returns></returns>
 public static void setDelay(GameObject targetGo,
                             float millisecond,
                             DelayCompleteHandler delayCompleteHandler,
                             bool autoDestroy    = true,
                             System.Object param = null)
 {
     if (targetGo == null)
     {
         return;
     }
     Delay.delay = targetGo.GetComponent <Delay>();
     if (Delay.delay == null)
     {
         Delay.delay = targetGo.AddComponent <Delay>();
     }
     Delay.isComplete           = false;
     Delay.millisecond          = millisecond;
     Delay.delayCompleteHandler = delayCompleteHandler;
     Delay.autoDestroy          = autoDestroy;
     Delay.param = param;
 }