Пример #1
0
        /// <summary>
        /// 处理施法(用于 直接释放技能)
        /// </summary>
        /// <param name="skill"></param>
        /// <param name="result"></param>
        public void HandleCast(Skill skill, int result)
        {
            //技能结束时间
            float skillOverTime = Time.time + skill.SkillData.SkillNeedTime;

            //播放动作
            SkillTask motionTask = new SkillTask("播放动作", new MotionCondition(skill));

            m_SkillTaskManager.AddTask(motionTask);

            //播放声音
            SkillTask soundTask = new SkillTask("播放声音", new SoundCondition(skill));

            m_SkillTaskManager.AddTask(soundTask);

            //释放特效
            SkillTask emitTask = new SkillTask("释放特效", new CastCondition(skill));

            m_SkillTaskManager.AddTask(emitTask);

            SkillTask skillTimeTask = new SkillTask("技能时长", new TimeAfterCondtion(skillOverTime));

            m_SkillTaskManager.AddTask(skillTimeTask);
            //打击效果
            //SkillTask hitTask = new SkillTask("打击效果", new HitCondition(skill, result, skill.SkillData.HurtDealy));
            //m_SkillTaskManager.AddTask(hitTask);

            //启动任务队列
            m_SkillTaskManager.Start(">>>技能施法流程", delegate()
            {
                skill.End();
            });
        }
Пример #2
0
        /// <summary>
        /// 用于检查技能结束的时候释放
        /// </summary>
        /// <param name="skill"></param>
        public void Fire(Skill skill)
        {
            //伤害计算
            DamageCondtion dmgCond = new DamageCondtion(skill, delegate(int result) { HandleCast(skill, result); });
            SkillTask      dmgTask = new SkillTask("伤害检查", dmgCond);

            m_SkillTaskManager.AddTask(dmgTask);
            //启动任务队列
            m_SkillTaskManager.Start(">>>技能伤害计算流程");
        }
Пример #3
0
        /// <summary>
        /// 执行下一个任务
        /// </summary>
        public SkillTask Next()
        {
            if (m_TaskQueue.Count > 0)
            {
                m_Task = m_TaskQueue.Dequeue();
                m_Task.Condition.Start();
            }
            else
            {
                m_Task = null;
            }

            return(m_Task);
        }
Пример #4
0
 private void CheckFinish(SkillTask skillTask)
 {
     Debug.Log(TextUtil.Format("当前执行的任务序列{0}, 当前任务{1}", this.m_QueueName, skillTask.m_Name));
     if (skillTask.IsFinish())
     {
         SkillTask current = Next();
         if (current != null)
         {
             CheckFinish(current);
         }
         else
         {
             EndSkill();
         }
     }
 }
Пример #5
0
        public void Start(string queueName = "", Action complate = null)
        {
            m_Complate  = complate;
            m_QueueName = queueName;

            SkillTask current = Next();

            if (current != null)
            {
                CheckFinish(current);
            }
            else
            {
                Log.Error("任务是空的!");
            }
        }
Пример #6
0
 /// <summary>
 /// 清除所有任务
 /// </summary>
 public void RemoveAllTask()
 {
     m_Task = null;
     m_TaskQueue.Clear();
 }
Пример #7
0
 /// <summary>
 /// 添加任务
 /// </summary>
 /// <param name="task"></param>
 public void AddTask(SkillTask task)
 {
     m_TaskQueue.Enqueue(task);
 }