Beispiel #1
0
        //达到伤害值,中断技能
        void OnBreakSkill()
        {
            //打断吟唱
            m_skillBase.BreakPrepareSkill();

            UnRegisterEvent();

            if (m_attackBreakDesc.isUsedUI)
            {
                CancelInvoke("UpdateShowTime");
                EventToUI.SendEvent("EU_DPSBAR_HIDE");
            }

            if (m_attackBreakDesc.behitAction.Length == 0)
            {
                m_skillBase.SkillEnd();
                return;
            }

            //播放被击动作
            m_skillBase.m_actor.StopAll();
            m_skillBase.m_actor.PlayAction(m_attackBreakDesc.behitAction);

            //动作完后结束技能
            Invoke("SkillEnd", m_skillBase.m_actor.GetActionLength(m_attackBreakDesc.behitAction));
        }
Beispiel #2
0
        void LateUpdate()
        {
            if (isStartMoving)
            {
                if (cellDesc.AttachToActor == false && cellDesc.Speed > 0 && cellDesc.PointList.Count > 1)
                {
                    int nextIndex = currentIndex + 1;


                    if ((cellDesc.PointList.Count > nextIndex))
                    {
                        Vector3 start = GetPos(currentIndex);

                        if (cellDesc.PointList[nextIndex].SkipWhenTouch)
                        {
                            start = curMovingPos;
                        }

                        Vector3 end = GetPos(nextIndex);

                        //如果回到actor重新获取信息
                        bool backToActor = (cellDesc.PointList[nextIndex].BackToActor && targetTransform != null);
                        if (backToActor)
                        {
                            start = curMovingPos;
                            end   = GetTargetPos();
                        }


                        Vector3 dir   = end - start;
                        float   disSQ = dir.sqrMagnitude;
                        dir.Normalize();
                        m_skillBase.transform.LookAt(end);
                        Vector3 dest = curMovingPos + dir * Time.deltaTime;

                        bool reachedEnd = false;

                        //到当前点的条件
                        if (backToActor)
                        {
                            reachedEnd = (disSQ <= 1);
                        }
                        else
                        {
                            reachedEnd = ((dest - start).sqrMagnitude >= disSQ);
                        }

                        //是否到了当前点
                        if (reachedEnd)
                        {
                            //是否在该点结束技能
                            if (cellDesc.PointList[nextIndex].EndSkill)
                            {
                                m_skillBase.SkillEnd();
                            }

                            //继续找下一个移动节点
                            curMovingPos = end;
                            m_skillBase.transform.forward = dir;
                            currentIndex++;
                        }
                        else
                        {
                            curMovingPos += dir * cellDesc.Speed * Time.deltaTime;
                        }

                        BaseTool.SetPosition(m_skillBase.transform, curMovingPos);
                    }
                }
                else if (cellDesc.AttachToActor == true && cellDesc.SyncRotation == false)
                {
                    //只同步位移,不同步旋转的情况
                    SyncPosition();
                }

                if (ProcessRotation(curMovingPos) == false)
                {
                    //不旋转直接设置位置
                    BaseTool.SetLocalPosition(m_skillBase.transform, curMovingPos);
                }
            }
        }