Esempio n. 1
0
        public bool CanBeBrokenByHit(StateParameter stateParm, SkillBehitDisplayDesc behitDisplay)
        {
            if (CoreEntry.gGameMgr.IsPvpState())
            {
                bool isBroken = false;
                if (behitDisplay != null)
                {
                    if (m_skillDesc != null)
                    {
                        if (behitDisplay.behitType >= BehitType.BT_HITBACK)
                        {
                            isBroken = true;
                        }
                    }
                }

                if (isBroken)
                {
                    if (m_actor != null)
                    {
                        m_actor.SetFlyText("打断", 0);
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
        //根据技能力度,怪物体形获取受击动作,以及硬直时间
        public BehitInfo GetBeHitInfo(int resID, int skillID)
        {
            BehitInfo info = new BehitInfo();

            LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(skillID);

            if (skillDesc == null)
            {
                return(info);
            }
            //int body = m_actor.GetAttribteValue(RoleAttrType.CS_ID_BODY);
            int bodyType = m_actor.BodyType;

            int weight = skillDesc.Get <int>("skillweight");



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

            List <ActionAndTime> listRet = new List <ActionAndTime>();


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

            if (behitDisplay == null)
            {
                if ((m_actor.mActorType == ActorType.AT_BOSS || m_actor.mActorType == ActorType.AT_LOCAL_PLAYER || m_actor.mActorType == ActorType.AT_PVP_PLAYER) &&
                    (m_attack.mActorType == ActorType.AT_BOSS || m_attack.mActorType == ActorType.AT_LOCAL_PLAYER || m_attack.mActorType == ActorType.AT_PVP_PLAYER))
                {
                    //普通受击,只有一个
                    ActionAndTime data = new ActionAndTime();
                    data.strAction = "hit001";
                    data.needTime  = m_actor.GetActionLength(data.strAction);

                    listRet.Add(data);

                    info.hitDistance  = 0;
                    info.moveDistance = 0;
                    //if (creatureDesc != null)
                    //{
                    //    info.moveDistance = creatureDesc.behitMoveBase * skillDesc.hitMoveScale / 100f;
                    //}
                    //else
                    //{
                    //    LogMgr.WarningLog("The creatureDesc is null.");
                    //}
                    info.moveTime = 0.1f;//skillDesc.hitMoveTime / 1000f;


                    //保证动作播放完成
                    info.exitStateTime = data.needTime;
                }

                info.strActionArry = listRet.ToArray();
                return(info);
            }

            //BOSS强制不浮空,只击退
            //if (m_actor.mActorType == ActorType.AT_BOSS && m_actor.IsInQiJue())
            //{
            //    if (behitDisplay.behitType == BehitType.BT_HITSKY)
            //    {
            //        behitDisplay.behitType = BehitType.BT_HITBACK;
            //    }

            //}


            //硬直时间
            info.NonControlTime = behitDisplay.nonControlSet.keepTime * 0.001f;

            BehitType behitType = behitDisplay.behitType;

            //动作
            if (behitDisplay.behitType == BehitType.BT_NORMAL)
            {
                //普通受击,只有一个
                ActionAndTime data = new ActionAndTime();
                data.strAction = behitDisplay.actionList[0];
                data.needTime  = m_actor.GetActionLength(data.strAction);

                listRet.Add(data);

                info.hitDistance = 0;

                //   info.moveDistance = skillDesc.hitMoveDistance;
                //   info.moveTime = 0.1f;
                info.moveDistance = 0;
                //if (creatureDesc != null)
                //{
                //    info.moveDistance = creatureDesc.behitMoveBase * skillDesc.hitMoveScale / 100f;
                //}
                //else
                //{
                //    LogMgr.WarningLog("The creatureDesc is null.");
                //}

                info.moveTime = 0.5f;//skillDesc.hitMoveTime / 1000f;


                //保证动作播放完成
                info.exitStateTime = data.needTime;
                if (m_actor.mActorType == ActorType.AT_BOSS)
                {
                    StateParameter stateParm = new StateParameter();
                    stateParm.state = ACTOR_STATE.AS_BEHIT;

                    stateParm.skillID = skillID;
                    m_actor.m_AttackState.BreakSkill(stateParm);
                }
            }
            else if (behitDisplay.behitType == BehitType.BT_HITBACK)
            {
                //击退,带有位移
                ActionAndTime data = new ActionAndTime();
                data.strAction = behitDisplay.actionList[0];
                data.needTime  = m_actor.GetActionLength(data.strAction);

                listRet.Add(data);
                info.hitDistance = 0;
                //if(creatureDesc != null)
                //{
                //    info.hitDistance = skillDesc.hitBackScale / 100f * creatureDesc.behitBackBase;
                //}
                //else
                //{
                //    LogMgr.WarningLog("The creatureDesc is null.");
                //}


                //需要打断技能
                if (m_attack.mActorType == ActorType.AT_BOSS)
                {
                    LuaTable pSkillDesc = m_actor.GetCurSkillDesc(m_actor.curCastSkillID);
                    if (pSkillDesc != null)
                    {
                        if (pSkillDesc.Get <int>("showtype") == 2) //大招和合击不能打断
                        {
                            StateParameter stateParm = new StateParameter();
                            stateParm.state = ACTOR_STATE.AS_BEHIT;

                            stateParm.skillID = skillID;
                            m_actor.m_AttackState.BreakSkill(stateParm);
                        }
                    }
                }



                // info.hitDistance = 1;       //保证释放被击位移
                // if (m_behitParame.damgageInfo.isNotUseCurveMove)
                // {
                //     info.hitDistance = 0;
                //  }

                //保证动作播放完成
                info.exitStateTime = data.needTime;
            }
            //else if (behitDisplay.behitType == BehitType.BT_HITDOWN)
            //{
            //    //击到
            //    ActionAndTime data = new ActionAndTime();
            //    data.strAction = behitDisplay.actionList[0];
            //    data.needTime = m_actor.GetActionLength(data.strAction);

            //    listRet.Add(data);

            //    info.hitDistance = skillDesc.iHitFlyScale / 100f * creatureDesc.fBehitFlyBase;
            //    //保证动作播放完成
            //    info.exitStateTime = data.needTime;

            //    m_isHitDownState = true;
            //}
            //else if (behitDisplay.behitType == BehitType.BT_HITSKY)
            //{
            //    //浮空,接管被击的硬直保护,硬直,退出时间等
            //    if (m_gravityMotionBase != null)
            //    {
            //        m_gravityMotionBase.StartHitToSky(skillDesc.hitSkyOriginV, skillDesc.hitSkyAngle);

            //        //需要打断技能
            //        StateParameter stateParm = new StateParameter();
            //        stateParm.state = ACTOR_STATE.AS_BEHIT;

            //        stateParm.skillID = skillID;
            //        m_actor.m_AttackState.BreakSkill(stateParm);

            //        info.isInSky = true;
            //        return info;
            //    }

            //    //没有浮空动作,采用hitdown
            //    behitType = BehitType.BT_HITDOWN;
            //}

            //击倒处理
            if (behitType == BehitType.BT_HITDOWN)
            {
                ActionAndTime data = new ActionAndTime();
                data.strAction = behitDisplay.actionList[0];
                data.needTime  = m_actor.GetActionLength(data.strAction);

                listRet.Add(data);
                info.hitDistance = 0;
                //if (creatureDesc != null)
                //{
                //    info.hitDistance = skillDesc.hitFlyScale / 100f * creatureDesc.behitFlyBase;
                //}
                //else
                //{
                //    LogMgr.WarningLog("The creatureDesc is null.");
                //}


                // info.hitDistance = 1;       //保证释放被击位移
                //  if (m_behitParame.damgageInfo.isNotUseCurveMove)
                //   {
                //       info.hitDistance = 0;
                //   }

                //保证动作播放完成

                if (m_actor.mActorType == ActorType.AT_BOSS)
                {
                    info.exitStateTime = data.needTime - 0.5f;
                }
                else
                {
                    info.exitStateTime = data.needTime - 0.2f;
                }

                m_isHitDownState = true;
            }


            //硬直保护
            if (//behitDisplay.behitType == BehitType.BT_HITBACK ||
                behitType == BehitType.BT_HITDOWN)
            {
                if (m_actor.mActorType == ActorType.AT_BOSS ||
                    m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    m_isNonControlProtect = true;
                }

                //取消目标

                if (m_attack.mActorType == ActorType.AT_LOCAL_PLAYER)
                {
                    //yy修改更换目标的BUG
                    //      actorObj.player.SelectTarget(null);
                }
            }

            //主角被击后,有位移
            if ((m_actor.mActorType == ActorType.AT_LOCAL_PLAYER || m_actor.mActorType == ActorType.AT_PVP_PLAYER) &&
                (info.hitDistance > 0 || info.moveDistance > 0))
            {
                //只旋转Y轴
                Vector3 lookPos = new Vector3(m_attack.transform.position.x,
                                              m_transform.position.y, m_attack.transform.position.z);

                m_transform.LookAt(lookPos);
            }

            //采用动作时间
            if (behitDisplay.nonControlSet.canReset)
            {
                foreach (ActionAndTime action in listRet)
                {
                    info.NonControlTime += action.needTime;
                }
            }


            info.strActionArry = listRet.ToArray();

            return(info);
        }
Esempio n. 3
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);
            }
        }