Exemplo n.º 1
0
        //浮空受击
        public void DoBehit()
        {
            //浮空状态不能释放技能
            m_BehitState.isNonControl = true;

            //离地面高度
            float height = GetHeightToGround();

            if (height <= 0.1f)
            {
                return;
            }

            if (nCount > 2)
            {
                m_actor.StopAll();
                string clipName = "hit006";
                m_actor.PlayAction(clipName);

                m_actor.SetActionSpeed(clipName, 2f);

                m_actor.UseCurveData1(clipName, 2.5f);

                m_isUseGravity = false;
                //  ExitBehitState();

                if (!m_actor.IsHadAction(clipName))
                {
                    Vector3    vCurPos = m_actor.transform.position;
                    RaycastHit curHit;
                    //强拉到地面
                    if (Physics.Raycast(vCurPos, -Vector3.up, out curHit, 10, m_groundLayerMask))
                    {
                        vCurPos.y = curHit.point.y;
                    }

                    BaseTool.SetPosition(m_transform, vCurPos);
                }


                float actionLen = m_actor.GetActionLength(clipName);
                Invoke("ExitBehitState", actionLen);
                nCount = 0;
                return;
            }

            nCount++;

            m_behitParame = m_actor.damageBebitParam;

            int skillID = m_behitParame.damgageInfo.skillID;

            //ActorObj m_hitActorBase = m_behitParame.damgageInfo.attackActor;

            //只处理带位移的普通技能
            //LuaTable skillDesc = m_hitActorBase.GetCurSkillDesc(skillID);
            char bodyType = (char)m_actor.BodyType;

            int weight = 1;

            //技能力度纠正
            if (m_behitParame.damgageInfo.weight > 0)
            {
                weight = m_behitParame.damgageInfo.weight;
                LogMgr.UnityLog("Gravity dobehit skillid=" + skillID + ", reset weight=" + weight);
            }

            //获取技能受击反馈
            SkillBehitDisplayDesc behitDisplay = m_gameDataBase.GetSkillBehitDisplayDesc(weight, bodyType);

            if (behitDisplay == null)
            {
                return;
            }

            //没有硬直,定格,没有位移
            if (!behitDisplay.isNonControl)
            {
                return;
            }

            //带位移
            float moveDistance = 0;

            //动作
            if (behitDisplay.behitType == BehitType.BT_NORMAL)
            {
                //普通受击
                // moveDistance = skillDesc.hitMoveDistance;
                moveDistance = 0.2f;
            }
            else if (behitDisplay.behitType == BehitType.BT_HITBACK)
            {
                //美术位移
                if (!m_behitParame.damgageInfo.isNotUseCurveMove)
                {
                    string clipName = behitDisplay.actionList[0];
                    moveDistance = m_actor.GetAnimationCurveLength(clipName);

                    //LogMgr.UnityLog("moveDistance=" + moveDistance + ", clipName=" + clipName);
                }
            }
            else if (behitDisplay.behitType == BehitType.BT_HITDOWN)
            {
                m_actor.StopAll();
                string clipName = behitDisplay.actionList[0];
                m_actor.PlayAction(clipName);
                m_actor.UseCurveData1(clipName, 2.5f);

                m_isUseGravity = false;
                //  ExitBehitState();

                if (!m_actor.IsHadAction(clipName))
                {
                    Vector3    vCurPos = m_actor.transform.position;
                    RaycastHit curHit;
                    //强拉到地面
                    if (Physics.Raycast(vCurPos, -Vector3.up, out curHit, 10, m_groundLayerMask))
                    {
                        vCurPos.y = curHit.point.y;
                    }

                    BaseTool.SetPosition(m_transform, vCurPos);
                }


                float actionLen = m_actor.GetActionLength(clipName);
                Invoke("ExitBehitState", actionLen);

                return;
            }


            else if (behitDisplay.behitType == BehitType.BT_HITSKY)
            {
                //浮空追击
                CancelInvoke("MoveDistanceEnd");
                CancelInvoke("AutoCancelStatic");

                F_ACCE = 0;
                //  SetOriginV(skillDesc.hitSkyOriginV, skillDesc.hitSkyAngle);

                m_actor.StopAll();
                m_actor.PlayAction("hit013", false);
                return;
            }

            //LogMgr.UnityLog("moveDistance=" + moveDistance);


            if (height < 0.5f)
            {
                return;
            }


            //没有位移
            if (moveDistance <= 0.001)
            {
                //F_ACCE = G_ACCE;
                SetOriginV(1, 90);
                m_actor.StopAll();
                m_actor.PlayAction("hit013", false);
            }
            else
            {
                //当前的高度
                SetOriginV(3, 75);
                m_actor.StopAll();
                m_actor.PlayAction("hit013", false);
            }
        }