Beispiel #1
0
        public IEnumerator _do_loop_by_condition(float interval, Func <bool> condition, Action call_back, float delay_time)
        {
            if (delay_time > 0f)
            {
                yield return(CoroutineConst.GetWaitForSeconds(delay_time));
            }
            // ReSharper disable once NotAccessedVariable
            int tmp_loop_count = 0;

            // ReSharper disable once LoopVariableIsNeverChangedInsideLoop
            while (condition())
            {
                tmp_loop_count++;
                call_back();
                yield return(CoroutineConst.GetWaitForSeconds(interval));
            }
        }
Beispiel #2
0
        /// <summary>
        /// 间隔时间进行多次动作
        /// </summary>
        public IEnumerator _do_loop_by_time(float interval, Action call_back, int loop_count = 1, float delay_time = 0f)
        {
            // 间隔时间,循环次数,回调,延迟时间时间
            if (delay_time > 0f)
            {
                yield return(CoroutineConst.GetWaitForSeconds(delay_time));
            }

            if (loop_count <= 0)
            {
                loop_count = int.MaxValue;
            }

            int tmp_loop_count = 0;

            while (tmp_loop_count < loop_count)
            {
                tmp_loop_count++;
                call_back();
                yield return(CoroutineConst.GetWaitForSeconds(interval));
            }
        }
Beispiel #3
0
        /// <summary>
        /// 每帧进行循环
        /// </summary>
        public IEnumerator _do_loop_by_every_frame(int loop_count, Action call_back, float delay_time)
        {
            // 循环次数,回调,开始时间
            if (delay_time > 0f)
            {
                yield return(CoroutineConst.GetWaitForSeconds(delay_time));
            }

            if (loop_count <= 0)
            {
                loop_count = int.MaxValue;
            }

            int tmp_loop_count = 0;

            while (tmp_loop_count < loop_count)
            {
                tmp_loop_count++;
                call_back();
                yield return(CoroutineConst.wait_for_end_of_frame);
            }
        }
Beispiel #4
0
 // 等待一定的时间
 public IEnumerator _do_wait_to_do(float time)
 {
     yield return(CoroutineConst.GetWaitForSeconds(time));
 }