예제 #1
0
 /// <summary>
 /// Initializes the specified character.
 /// </summary>
 /// <param name="Character">The character.</param>
 private void Initialize(Character Character)
 {
     TaskList = new List <ITask>
     {
         (NavTask = new NavTask(Character)),
     };
 }
        /// <summary>
        /// 导航层Update
        /// </summary>
        /// <param name="delta">deltaTime</param>
        public void Update(float delta)
        {
            //倒序遍历
            for (int i = views.Count - 1; i >= 0; i--)
            {
                var v = views[i];


                //当前的帧循环

                //float start = Time.realtimeSinceStartup;
                v.Update(delta);
                //float end = Time.realtimeSinceStartup;

                //My JDeBug.Inst.Log( "[" + v.name + "] - " + "View Update execution time:" + (end - start));

                //如果IScreenView不透明,直接break,不处理后面的IScreenView
                if (!v.IsTransparent)
                {
                    break;
                }
                //如果isLoad = false,直接break,不处理后面的IScreenView
                if (!v.IsLoad)
                {
                    break;
                }
            }

            //遍历导航列表
            foreach (var t in tasks)
            {
                //更新任务
                // float start = Time.time;
                t.view.UpdateTask(delta);
                // float end = Time.time;

                //Debug.LogError("UpdateTask execution time:" + (end - start));
            }
            //如果当前任务为空且任务队列数量大于0
            if (taskCurrect == null && tasks.Count > 0)
            {
                // float start = Time.time;
                //出队
                taskCurrect = tasks.Dequeue();
                //执行任务
                taskCurrect.Begin();
                // float end = Time.time;

                //Debug.LogError("task execution time:" + (end - start));
            }
            //如果当前任务不为空且当前任务已完成,设置当前任务为空
            if (taskCurrect != null && taskCurrect.done)
            {
                //将当前任务置空
                taskCurrect = null;
                //                My JDeBug.Inst.Log("TaskFinish");
            }
        }
예제 #3
0
        public void Update(float delta)
        {
            for (int i = views.Count - 1; i >= 0; i--)
            {
                var v = views[i];


                //当前的帧循环

                //float start = Time.realtimeSinceStartup;
                v.Update(delta);
                //float end = Time.realtimeSinceStartup;

                //MyDebug.Log( "[" + v.name + "] - " + "View Update execution time:" + (end - start));


                if (!v.isTransparent)
                {
                    break;
                }
                if (!v.isLoad)
                {
                    break;
                }
            }
            foreach (var t in tasks)
            {
                // float start = Time.time;
                t.view.UpdateTask(delta);
                // float end = Time.time;

                //Debug.LogError("UpdateTask execution time:" + (end - start));
            }
            if (taskCurrect == null && tasks.Count > 0)
            {
                // float start = Time.time;
                taskCurrect = tasks.Dequeue();
                taskCurrect.Begin();
                // float end = Time.time;

                //Debug.LogError("task execution time:" + (end - start));
            }
            if (taskCurrect != null && taskCurrect.done)
            {
                taskCurrect = null;
//                MyDebug.Log("TaskFinish");
            }
        }