Esempio n. 1
0
        public void CalculateDamage(GameObject obj)
        {
            bool     isDamageSuccess = true;
            ActorObj actorBase       = (obj.GetComponent <ActorObj>());

            //纠正被击表现
            DamageParam damageParam = new DamageParam();

            damageParam.skillID           = m_skillBase.m_skillID;
            damageParam.attackActor       = m_skillBase.m_actor;
            damageParam.behitActor        = actorBase;
            damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
            damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

            CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

            //是否有眩晕效果
            if (m_oneDamageInfo.dizzyParamDesc != null)
            {
                DizzyParam param = new DizzyParam();
                param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                actorBase.OnEnterDizzy(param);
            }

            if (isDamageSuccess && (actorBase.mActorType == ActorType.AT_MONSTER || actorBase.mActorType == ActorType.AT_MECHANICS))
            {
                m_isHadLoadFrameStop = true;


                GameObject frameStopObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell("Skill/Cell/frameStop");
                frameStopObj.transform.parent = transform;

                ISkillCell skillCell = frameStopObj.GetComponent <ISkillCell>();

                skillCell.Init(m_oneDamageInfo.frameStopDesc, m_skillBase, actorBase);

                m_skillBase.AddSkillCell(frameStopObj);
            }
        }
Esempio n. 2
0
        public override void OnEnter(Buff _ownerBuff)
        {
            base.OnEnter(_ownerBuff);

            if (m_type == (int)limitType.Dizzy)
            {
                // 眩晕
                DizzyParam param = new DizzyParam();
                param.keepTime = ownerBuff.mLife;
                owner.OnEnterDizzy(param);

                //眩晕对应的状态不同
                RelativeState = ACTOR_STATE.AS_DIZZY;
            }

            if (m_type == (int)limitType.Sleep || m_type == (int)limitType.Frozen ||
                m_type == (int)limitType.Move || m_type == (int)limitType.Attack || m_type == (int)limitType.Skill ||
                m_type == (int)limitType.Floating || m_type == (int)limitType.Hitdown)
            {
                LimitParam param = new LimitParam();
                param.keepTime   = ownerBuff.mLife;
                param.bStopActor = false;
                param.iState     = m_type;
                if (m_type == (int)limitType.Sleep)
                {
                    // 睡眠
                    param.buffid = ownerBuff.mBuffType;
                }
                if (m_type == (int)limitType.Frozen)
                {
                    // 冰冻
                    param.bStopActor = true;
                }

                owner.OnEnterLimit(param);
            }
        }
Esempio n. 3
0
        public override void OnEnter(ActorObj actorBase)
        {
            m_state = ACTOR_STATE.AS_DIZZY;

            m_actor      = actorBase;
            m_dizzyParam = m_actor.dizzyParam;

            //播放动作
            dizzyAction = "hit014"; //m_actor.actorCreatureDisplayDesc.DizzyAction;
            if (dizzyAction.Length <= 0)
            {
                //没有,就使用默认的动作
                dizzyAction = m_actor.ModelConfig.Get <string>("san_walk");
            }

            if (m_actor.IsPlayingAction(dizzyAction) == false)
            {
                m_actor.StopAll(); // 当前动作
                m_actor.PlayAction(dizzyAction);
            }

            string dizzyEfx = "Effect/skill/buff/fx_bf_xuanyun"; //;m_actor.actorCreatureDisplayDesc.DizzyEfx;

            if (dizzyEfx.Length > 0)
            {
                if (efxObj == null)
                {
                    Object tmpObj = CoreEntry.gResLoader.LoadResource(dizzyEfx);
                    if (tmpObj != null)
                    {
                        efxObj = Instantiate(tmpObj) as GameObject;
                    }

                    SceneEfx sceneEfx = efxObj.AddComponent <SceneEfx>();
                    sceneEfx.Init(m_actor.transform.position, m_dizzyParam.keepTime);

                    //设置有挂点的特效
                    Transform[] childTransform = efxObj.GetComponentsInChildren <Transform>();
                    for (int i = 0; i < childTransform.Length; i++)
                    {
                        Transform         childTrans = childTransform[i];
                        EfxSetAttachPoint setAttach  = childTrans.gameObject.GetComponent <EfxSetAttachPoint>();
                        if (setAttach == null || setAttach.m_attachPointEnum == AttachPoint.E_None)
                        {
                            continue;
                        }

                        setAttach.Init(false);

                        Transform parent = m_actor.GetChildTransform(setAttach.m_attachPointEnum.ToString());
                        if (parent != null)
                        {
                            // 因为 top 绑定会旋转所以这里取了相对位置
                            childTrans.parent        = m_actor.transform;
                            childTrans.localPosition = new Vector3(0, parent.localPosition.y, 0);
                            childTrans.localRotation = Quaternion.identity;
                            childTrans.localScale    = Vector3.one;

                            SceneEfx sceneEfx1 = childTrans.gameObject.AddComponent <SceneEfx>();
                            sceneEfx1.Init(childTrans.position, m_dizzyParam.keepTime);
                        }
                    }
                }
            }

            //状态硬直,不可转换其他状态
            m_isNonControl = true;

            CancelInvoke("AutoExitState");
            Invoke("AutoExitState", m_dizzyParam.keepTime);

            //EventToUI.SetArg(UIEventArg.Arg1, gameObject);
            //EventToUI.SetArg(UIEventArg.Arg2, (float)m_dizzyParam.keepTime);
            //EventToUI.SendEvent("EU_ENTER_DIZZY");
        }
Esempio n. 4
0
        protected virtual void CalculateDamage()
        {
            // System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            //  sw.Start();
            CancelInvoke("CalculateDamage");

            bool isDamageSuccess = false;

            LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_skillBase.m_skillID);

            if (skillDesc == null)
            {
                return;
            }

            if (m_skillMgr.m_bShowSkillScope)
            {
                Vector3 pos = m_skillBase.m_actor.transform.position;
                if (null == m_SkillScope)
                {
                    if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
                    {
                        if (DamageTypeID.DTID_FUN == m_oneDamageInfo.type)
                        {
                            if (m_oneDamageInfo.damageNode.funDamage.angle >= 360)
                            {
                                m_SkillScope = WarningDecel.CreateSectorDecal("Effect/skill/remain/fx_yujing_yuan", pos,
                                                                              m_oneDamageInfo.damageNode.funDamage.radius * 2, m_oneDamageInfo.damageNode.funDamage.angle);
                            }
                            else
                            {
                                m_SkillScope = WarningDecel.CreateSectorDecal("Effect/skill/remain/fx_yujing_shanxing", pos,
                                                                              m_oneDamageInfo.damageNode.funDamage.radius * 2, m_oneDamageInfo.damageNode.funDamage.angle);
                            }


                            if (m_oneDamageInfo.damageNode.funDamage.angle < 360)
                            {
                                float   ActorAngle = 0.0f;
                                Vector3 ActorAxis  = Vector3.zero;
                                m_skillBase.m_actor.transform.rotation.ToAngleAxis(out ActorAngle, out ActorAxis);
                                if (m_SkillScope != null)
                                {
                                    float angle = Mathf.Acos(Vector3.Dot(m_skillBase.m_actor.transform.forward.normalized, new Vector3(1.0f, 0f, 0f))) * Mathf.Rad2Deg;
                                    if (ActorAngle >= 90 && ActorAngle <= 270)
                                    {
                                        m_SkillScope.transform.RotateAround(pos, Vector3.up, angle);
                                    }
                                    else
                                    {
                                        m_SkillScope.transform.RotateAround(pos, Vector3.up, -angle);
                                    }
                                }

                                //LogMgr.UnityLog("angle="+angle.ToString());


                                // m_SkillScope.transform.position += m_SkillScope.transform.up * 0.1f;
                            }
                        }
                        else if (DamageTypeID.DTID_RECT == m_oneDamageInfo.type)
                        {
                            m_SkillScope = WarningDecel.CreateRectangleDecal("Effect/skill/remain/fx_yujing_changfang", pos,
                                                                             m_oneDamageInfo.damageNode.rectDamage.width, m_oneDamageInfo.damageNode.rectDamage.length);
                            if (m_SkillScope != null)
                            {
                                m_SkillScope.transform.rotation  = m_skillBase.m_actor.transform.rotation;
                                m_SkillScope.transform.position += m_oneDamageInfo.damageNode.rectDamage.length / 2 * m_skillBase.m_actor.transform.forward;
                            }
                        }
                    }
                    //Invoke("HideSkillScope", m_oneDamageInfo.hitTime);
                }
            }

            //单体伤害
            if (!m_bIsAoe)
            {
                ActorObj targetObj = m_skillBase.m_actor.GetSelTarget();

                if (targetObj != null && m_skillBase.m_actor.IsSkillAim((sbyte)m_skillBase.m_skillDesc.Get <int>("faction_limit"), targetObj))
                {
                    ActorObj actorBase = targetObj;

                    //按伤害范围算出受伤害对象,具体有没有伤害,还要看对应的属性(免疫等)
                    bool isSkillSuccess = m_skillMgr.IsSkillDamageRange(skillDesc.Get <int>("effect_1"), m_transform,
                                                                        targetObj.transform, actorBase.GetColliderRadius());

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        isDamageSuccess = true;

                        //纠正被击表现
                        DamageParam damageParam = new DamageParam();
                        damageParam.skillID = m_skillBase.m_skillID;
                        //damageParam.attackObj = m_skillBase.m_castOwnObj;
                        damageParam.attackActor = m_skillBase.m_actor;

                        //damageParam.behitObj = attackObj.gameObject;
                        damageParam.behitActor = actorBase;
                        damageParam.IsClient   = true;

                        damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
                        damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

                        CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

                        //是否有眩晕效果
                        if (m_oneDamageInfo.dizzyParamDesc != null)
                        {
                            DizzyParam param = new DizzyParam();
                            param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                            actorBase.OnEnterDizzy(param);
                        }
                    }
                }
            }
            else
            {
                //计算伤害  群体
                if (m_skillBase.m_actor == null)
                {
                    return;
                }

                ActorObj actor = null;

                for (int k = 0; k < m_skillBase.m_actor.m_TargetList.Count; ++k)
                {
                    actor = CoreEntry.gActorMgr.GetActorByServerID(m_skillBase.m_actor.m_TargetList[k]);

                    if (ArenaMgr.Instance.IsArenaFight)
                    {
                        actor = CoreEntry.gActorMgr.GetPlayerActorByServerID(m_skillBase.m_actor.m_TargetList[k]);
                    }

                    if (actor == null)
                    {
                        continue;
                    }

                    //对IOS出现怪物不动 报错的异常  进行错误处理
                    if (GameLogicMgr.checkValid(actor.gameObject) == false)
                    {
                        continue;
                    }

                    {
                        isDamageSuccess = true;

                        //纠正被击表现
                        DamageParam damageParam = new DamageParam();
                        damageParam.skillID = m_skillBase.m_skillID;
                        // damageParam.attackObj = m_skillBase.m_castOwnObj;
                        damageParam.attackActor = m_skillBase.m_actor;
                        // damageParam.behitObj = obj.gameObject;
                        damageParam.behitActor        = actor;
                        damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
                        damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

                        damageParam.IsClient = true;

                        CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

                        //是否有眩晕效果
                        if (m_oneDamageInfo.dizzyParamDesc != null)
                        {
                            DizzyParam param = new DizzyParam();
                            param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                            actor.OnEnterDizzy(param);
                        }

                        if (isDamageSuccess && actor.mActorType == ActorType.AT_BOSS && m_skillBase.m_actor.IsMainPlayer())
                        {
                            m_isHadLoadFrameStop = true;

                            //顿帧
                            if (m_oneDamageInfo.frameStopDesc != null)
                            {
                                //GameObject frameStopObj = Instantiate(
                                //    CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.frameStopDesc.prefabPath)) as GameObject;
                                GameObject frameStopObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.frameStopDesc.prefabPath);

                                ISkillCell skillCell = frameStopObj.GetComponent <ISkillCell>();
                                if (skillCell)
                                {
                                    skillCell.Init(m_oneDamageInfo.frameStopDesc, m_skillBase, actor);
                                    m_skillBase.AddSkillCell(frameStopObj);
                                }
                                else
                                {
                                    //没有skillcell说明,坏掉了马上清理掉
                                    Destroy(frameStopObj);
                                }
                            }
                        }
                    }
                }
            }


            LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillBase.m_skillID);


            string remanEfx = null;

            if (skill_action != null)
            {
                remanEfx = skill_action.Get <string>("remain");
            }


            //地表残留
            if (remanEfx.Length > 0 && m_oneDamageInfo.m_bUseRemain)
            {
                //GameObject efxObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(remanEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);


                if (efxObj == null)
                {
                    //efxObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(remanEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                }


                //yy 特效和模型按等比例缩放
                //if (m_skillBase.m_actor.actorCreatureDisplayDesc.sacle > 1.0f)
                //{
                //    ParticleScaler ScaleComponet = efxObj.GetComponent<ParticleScaler>();
                //    if (ScaleComponet == null)
                //        ScaleComponet = efxObj.AddComponent<ParticleScaler>();

                //    ScaleComponet.particleScale = m_skillBase.m_actor.actorCreatureDisplayDesc.sacle;

                //}


                float maxEfxTime = 0;

                if (efxObj)
                {
                    NcCurveAnimation[] efxAnimations = efxObj.GetComponentsInChildren <NcCurveAnimation>();
                    for (int i = 0; i < efxAnimations.Length; ++i)
                    {
                        // efxAnimations[i].m_fDelayTime /= m_speed;
                        // efxAnimations[i].m_fDurationTime /= m_speed;

                        float efxTime = efxAnimations[i].m_fDelayTime + efxAnimations[i].m_fDurationTime;
                        if (efxTime > maxEfxTime)
                        {
                            maxEfxTime = efxTime;
                        }
                    }
                }

                if (skill_action != null)
                {
                    if (skill_action.Get <float>("skillEfxLength") > 0)
                    {
                        maxEfxTime = skill_action.Get <float>("skillEfxLength");
                    }

                    //特效存在时间
                    if (maxEfxTime <= 0.001)
                    {
                        maxEfxTime = m_skillBase.m_actor.GetActionLength(skill_action.Get <string>("animation"));
                    }
                }


                EfxAttachActionPool efx = efxObj.GetComponent <EfxAttachActionPool>();
                if (efx == null)
                {
                    efx = efxObj.AddComponent <EfxAttachActionPool>();
                }

                //yy test

                efx.InitRemain(m_skillBase.m_actor.transform, maxEfxTime, false);


                m_RemainEfx = efx;
            }



            //场景物件,主角破坏
            if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray;
                for (int i = 0; i < brokedObjs.Length; ++i)
                {
                    if (brokedObjs[i] == null)
                    {
                        continue;
                    }

                    bool isSkillSuccess = m_skillMgr.IsSkillDamageRange(skillDesc.Get <int>("effect_1"), m_transform, brokedObjs[i].transform, 0.5f);

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        Broked broked = brokedObjs[i].GetComponent <Broked>();
                        int    weight = 3;//m_skillBase.m_skillDesc.weight;
                        if (m_oneDamageInfo.resetSkillWeight > 0)
                        {
                            weight = m_oneDamageInfo.resetSkillWeight;
                        }

                        broked.DoBroked(m_skillBase.m_actor.thisGameObject, weight);
                    }
                }
            }

            //if (isDamageSuccess && !m_isHadLoadFrameStop)
            //{
            //    m_isHadLoadFrameStop = true;

            //    //顿帧
            //    if (m_oneDamageInfo.frameStopDesc != null)
            //    {
            //        GameObject frameStopObj = Instantiate(
            //            CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.frameStopDesc.prefabPath)) as GameObject;

            //        ISkillCell skillCell = frameStopObj.GetComponent<ISkillCell>();

            //        skillCell.Init(m_oneDamageInfo.frameStopDesc,m_skillBase.m_actor);

            //        m_skillBase.AddSkillCell(frameStopObj);
            //    }

            //}

            //屏震    不是主玩家 , 就不震屏幕
            if (m_skillBase.m_actor.IsMainPlayer() || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
            {
                if (m_oneDamageInfo.cameraShakeDesc != null)
                {
                    if (m_oneDamageInfo.cameraShakeDesc.activeWhenHit == false ||
                        (m_oneDamageInfo.cameraShakeDesc.activeWhenHit == true && isDamageSuccess == true)
                        )
                    {
                        //GameObject cellObj = Instantiate(
                        //    CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.cameraShakeDesc.prefabPath)) as GameObject;

                        GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.cameraShakeDesc.prefabPath);
                        cellObj.transform.parent = transform;

                        // m_oneDamageInfo.cameraShakeDesc.playTime = m_oneDamageInfo.hitTime;

                        ISkillCell skillCell = cellObj.GetComponent <ISkillCell>();
                        skillCell.Init(m_oneDamageInfo.cameraShakeDesc, m_skillBase);

                        m_skillBase.AddSkillCell(cellObj);
                    }
                }
            }



            //是否持续伤害
            if (m_oneDamageInfo.isRepeatedly && m_repeateKeep > 0)
            {
                Invoke("CalculateDamage", m_oneDamageInfo.damageDiff / m_skillBase.m_speed);
                --m_repeateKeep;
            }

            // sw.Stop();
            if (m_skillBase.m_actor.IsLocalPlayer())
            {
                // Debug.LogError("3....." + sw.ElapsedMilliseconds + "毫秒.....");
            }
        }