Exemple #1
0
        public override void Preload(ISkillCellData cellData, SkillBase skillBase)
        {
            //m_dataIndex = param.damageCellIndex;
            m_oneDamageInfo = (OneDamageInfo)cellData;
            m_skillBase     = skillBase;

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

            if (frameStopObj != null)
            {
                frameStopObj.transform.parent = transform;

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

                skillCell.Preload(m_oneDamageInfo.frameStopDesc, m_skillBase);

                m_skillBase.AddSkillCell(frameStopObj);
            }

            if (m_oneDamageInfo.cameraShakeDesc != null)
            {
                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.cameraShakeDesc.prefabPath);
                cellObj.transform.parent = transform;

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

                m_skillBase.AddSkillCell(cellObj);
            }
        }
Exemple #2
0
 //元素之间的发送消息
 public void SendEvent(SkillCellEventType eventType, params ValueArg[] valueArgs)
 {
     for (int i = 0; i < m_skillCellObjectlist.Count; ++i)
     {
         ISkillCell skillCell = m_skillCellObjectlist[i].GetComponent <ISkillCell>();
         skillCell.OnEvent(eventType, valueArgs);
     }
 }
Exemple #3
0
 void CheckSkillCell(ISkillCell skillCell)
 {
     if (skillCell != null)
     {
         if (skillCell is PositionCell)
         {
             canMove    = false;
             canBeBroke = false;
         }
         else if (skillCell is CompositedSkillCell)
         {
             compositedSkillCell = skillCell as CompositedSkillCell;
         }
     }
 }
Exemple #4
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);
            }
        }
Exemple #5
0
        public void ShowSkillScope()
        {
            SkillClassDisplayDesc skillClass =
                m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID"));

            if (skillClass == null)
            {
                Debug.LogError("===skillClass== is null===");
                return;
            }
            LuaTable skilleffect = ConfigManager.Instance.Skill.GetEffectConfig(m_skillID);

            if (skilleffect.Get <int>("range") == (int)SkillRangeType.SKILL_TARGET)
            //       if ((int)m_skillDesc.atkType == (int)Configs.skillConfig.AtkTypeEnum.SINGLE)
            {
                m_bIsAoe = false;
            }

            //吟唱阶段
            for (int i = 0; i < skillClass.prepareStageDataList.Count; ++i)
            {
                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.prepareStageDataList[i].prefabPath);
                cellObj.transform.parent = transform;

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

                skillCell.Init(skillClass.prepareStageDataList[i], this);
                skillCell.SetAoeState(m_bIsAoe);

                AddSkillCell(cellObj);
            }

            //技能元素
            for (int i = 0; i < skillClass.castStageDataList.Count; ++i)
            {
                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath);
                cellObj.transform.parent = transform;

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

                skillCell.Init(skillClass.castStageDataList[i], this);
                skillCell.SetAoeState(m_bIsAoe);

                AddSkillCell(cellObj);
            }

            // 删除原来的预警贴花
            if (m_actor.m_WarningefxObj != null)
            {
                Destroy(m_actor.m_WarningefxObj);
                m_actor.m_WarningefxObj = null;
            }

            // 读取新的预警贴花
            for (int i = 0; i < m_skillCellObjectlist.Count; i++)
            {
                ISkillCell skillCell = m_skillCellObjectlist[i].GetComponent <ISkillCell>();
                skillCell.ShowSkillScope();
                if (m_actor.m_WarningefxObj != null)
                {
                    break;
                }
            }

            if (m_actor.m_WarningefxObj != null)
            {
                EfxAttachActionPool efx = m_actor.m_WarningefxObj.GetComponent <EfxAttachActionPool>();
                if (efx == null)
                {
                    efx = m_actor.m_WarningefxObj.AddComponent <EfxAttachActionPool>();
                }
                efx.Init(m_actor.transform, 100000f, true);
            }
        }
Exemple #6
0
        //释放技能
        void CastSkill()
        {
            CancelInvoke("CastSkill");
            CancelInvoke("AutoLookatTarget");

            // 如果不是激活状态不往下运行
            if (!gameObject.activeInHierarchy)
            {
                return;
            }

            //释放吟唱阶段的动作特效
            SendEvent(SkillCellEventType.SE_DESTROY_ACTION_EFX, null);

            //销毁吟唱阶段数据
            DestroyEfx();

            //播放动作,特效,声音
            SkillPlayParam param        = new SkillPlayParam();
            LuaTable       skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillID);

            if (skill_action == null)
            {
                Debug.LogError("skill_action is null...m_skillID = " + m_skillID);
                return;
            }
            if (skill_action != null)
            {
                param.action = skill_action.Get <string>("animation");

                param.actionEfx = skill_action.Get <string>("skilleffect");

                param.startTime = m_startPlayTimeSet;
                param.speed     = m_speed;

                param.remainEfx = skill_action.Get <string>("remain");
            }

            //播放声音
            string sound1 = "";
            string sound2 = "";

            AudioCore.GenerateAudio(m_skillDesc.Get <int>("sound_id"), ref sound1);
            AudioCore.GenerateAudio(m_skillDesc.Get <int>("talk_sound_id"), ref sound2);

            param.sound = sound1;
            param.voice = sound2;

            StartCoroutine(PlayActionEfxSound(param, skill_action.Get <float>("skillEfxDelay")));

            //技能元素
            SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID"));

            if (skillClass == null)
            {
                Debug.LogError("===skillClass== is null===");
                return;
            }
            bool isLocal = false;

            if (m_actor is PlayerObj || m_actor is PetObj)
            {
                isLocal = true;
            }
            for (int i = 0; i < skillClass.castStageDataList.Count; ++i)
            {
                if (null != m_actor && !isLocal)
                {
                    if (skillClass.castStageDataList[i] is MovePosAttackDesc)
                    {
                        continue;
                    }
                }

                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath);
                cellObj.transform.parent = transform;

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

                skillCell.Init(skillClass.castStageDataList[i], this);
                skillCell.SetAoeState(m_bIsAoe);

                CheckSkillCell(skillCell);
                AddSkillCell(cellObj);
            }

            //技能结束时间
            if (m_skillDesc.Get <int>("skill_end") > 0)
            {
                m_overTime = (m_skillDesc.Get <int>("skill_end") / 1000f - m_startPlayTimeSet) / m_speed;
            }
            else
            {
                m_overTime = (m_actor.GetActionLength(m_strActionName) - m_startPlayTimeSet) / m_speed;
            }

            //如果是不可打破机能,释放出后恢复动作
            if (canBeBroke == false)
            {
                float time = (m_actor.GetActionLength(m_strActionName) - m_startPlayTimeSet) / m_speed;
                CancelInvoke("SkillAnimationIsOver");
                Invoke("SkillAnimationIsOver", time);
            }
            LogMgr.UnityLog("overtime=" + m_overTime + ", skillid=" + m_skillID);

            //技能结束
            Invoke("SkillEnd", m_overTime);
        }
Exemple #7
0
        // Use this for initialization
        void Start()
        {
            IsOver = false;
            CancelInvoke("Start");

            if (m_onlyShowSkillScope)
            {
                return;
            }

            m_AttackList.Clear();
            compositedSkillCell = null;

            ShowBossSkillWarning();

            SkillClassDisplayDesc skillClass =
                m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID"));

            if (skillClass == null)
            {
                Debug.LogError("===skillClass== is null===");
                return;
            }
            if (null != m_skilleffect && m_skilleffect.Get <int>("range") == (int)SkillRangeType.SKILL_TARGET)
            {
                m_bIsAoe = false;
            }

            if (skillClass.prepareStage == null || skillClass.prepareStage.open == false)
            {
                //直接进入释放技能阶段
                CastSkill();
                return;
            }

            //吟唱阶段
            bool isLocal = false;

            if (m_actor is PlayerObj || m_actor is PetObj)
            {
                isLocal = true;
            }
            for (int i = 0; i < skillClass.prepareStageDataList.Count; ++i)
            {
                if (null != m_actor && !isLocal)
                {
                    if (skillClass.prepareStageDataList[i] is MovePosAttackDesc)
                    {
                        continue;
                    }
                }

                //GameObject cellObj = Instantiate(
                //    CoreEntry.gResLoader.LoadResource(skillClass.prepareStageDataList[i].prefabPath)) as GameObject;
                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.prepareStageDataList[i].prefabPath);
                cellObj.transform.parent = transform;

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

                skillCell.Init(skillClass.prepareStageDataList[i], this);
                skillCell.SetAoeState(m_bIsAoe);

                AddSkillCell(cellObj);
            }

            if (skillClass.prepareStage.isLookAtTarget)
            {
                InvokeRepeating("AutoLookatTarget", 0f, 0.1f);
            }

            m_prepareKeepTime = skillClass.prepareStage.keepTime;

            //吟唱结束,进入释放阶段
            Invoke("CastSkill", skillClass.prepareStage.keepTime);
            Syncm_transform();
        }
Exemple #8
0
        public void Preload(ActorObj own, int skillID)
        {
            m_skillID            = skillID;
            m_onlyShowSkillScope = true;
            m_actor     = own;
            m_skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_skillID);
            if (m_skillDesc == null)
            {
                return;
            }

            SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID"));

            if (skillClass == null)
            {
                return;
            }

            //吟唱阶段
            for (int i = 0; i < skillClass.prepareStageDataList.Count; ++i)
            {
                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.prepareStageDataList[i].prefabPath);
                cellObj.transform.parent = transform;

                ISkillCell skillCell = cellObj.GetComponent <ISkillCell>();
                skillCell.Preload(skillClass.prepareStageDataList[i], this);
                AddSkillCell(cellObj);
            }

            //技能元素
            for (int i = 0; i < skillClass.castStageDataList.Count; ++i)
            {
                GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath);
                if (cellObj == null)
                {
                    LogMgr.UnityError("Can not found prefab: " + skillClass.castStageDataList[i].prefabPath + " ! of skillID " + skillClass.skillID + " : " + skillClass.castStageDataList[i].ToString());
                    continue;
                }

                cellObj.transform.parent = transform;

                ISkillCell skillCell = cellObj.GetComponent <ISkillCell>();
                skillCell.Preload(skillClass.castStageDataList[i], this);
                AddSkillCell(cellObj);
            }

            // 动作特效加载
            LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(skillID);

            if (skill_action != null && skill_action.Get <string>("skilleffect").Length > 0)
            {
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(skill_action.Get <string>("skilleffect"));
                if (efxObj != null)
                {
                    CoreEntry.gGameObjPoolMgr.Destroy(efxObj);
                }
                else
                {
                    LogMgr.LogError("can not find attackEfxPrefab path: " + skill_action.Get <string>("skilleffect"));
                }
            }

            // 受击特效加载
            string pfx_hurt = m_skillDesc.Get <string>("pfx_hurt");

            if (pfx_hurt.Length > 0)
            {
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(pfx_hurt);
                if (efxObj != null)
                {
                    CoreEntry.gGameObjPoolMgr.Destroy(efxObj);
                }
            }

            DestroyEfx();
        }
Exemple #9
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 + "毫秒.....");
            }
        }
Exemple #10
0
        void Fire()
        {
            CancelInvoke("Fire");

            //屏震    不是主玩家 , 就不震屏幕
            if (m_skillBase != null && m_skillBase.m_actor != null && m_skillBase.m_actor.gameObject != null)
            {
                if (m_skillBase.m_actor.IsMainPlayer() || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
                {
                    if (m_fireFlyAttackDesc.cameraShakeDesc != null)
                    {
                        //GameObject cellObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(m_fireFlyAttackDesc.cameraShakeDesc.prefabPath));//CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_fireFlyAttackDesc.cameraShakeDesc.prefabPath);
                        GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_fireFlyAttackDesc.cameraShakeDesc.prefabPath);
                        cellObj.transform.parent = transform;

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

                        m_skillBase.AddSkillCell(cellObj);
                    }
                }
            }

            //发射点位置
            Transform flyTransform = null;

            if (m_skillBase != null)
            {
                flyTransform = m_skillBase.FindChildTransform(m_fireFlyAttackDesc.firePos);
            }
            if (flyTransform == null)
            {
                LogMgr.UnityError("FireflyCell没有找到绑定点 \"" + m_fireFlyAttackDesc.firePos + "\"");
                return;
            }
            if (m_skillBase == null)
            {
                return;
            }
            // float diffAngle = 360f / m_fireFlyAttackDesc.bulletNum;
            float diffAngle = m_fireFlyAttackDesc.fAngle;

            for (int i = 0; i < m_fireFlyAttackDesc.bulletNum; ++i)
            {
                //加载子弹
                GameObject objBullet =
                    (GameObject)Instantiate(CoreEntry.gResLoader.LoadResource(m_fireFlyAttackDesc.bulletPrefab));
                if (objBullet == null)
                {
                    return;
                }

                objBullet.transform.position = flyTransform.position;

                Vector3 targetpos = new Vector3(0, 0, 0);

                // 下面这句有时候会造成弓箭兵 射出的箭向后飞,目标错乱
                //ActorObj actorObj = m_skillBase.m_actor.GetAttackObj();
                //if (actorObj == null)
                //    actorObj = m_skillBase.m_hateActor;

                ActorObj actorObj = m_skillBase.GetSelTarget();

                if (actorObj != null && m_fireFlyAttackDesc.bulletNum == 1)
                {
                    //单个目标,指向目标方向
                    //Vector3 aimPos = new Vector3(actorObj.thisGameObject.transform.position.x,
                    //    objBullet.transform.position.y, actorObj.thisGameObject.transform.position.z);

                    //aimPos = Vector3.Normalize(aimPos);

                    //objBullet.transform.LookAt(aimPos);

                    //Vector3 aimPos = new Vector3(actorObj.thisGameObject.transform.position.x,
                    //    objBullet.transform.position.y, actorObj.thisGameObject.transform.position.z);

                    Vector3 aimPos = new Vector3();
                    aimPos   = actorObj.thisGameObject.transform.position;
                    aimPos.y = actorObj.GetBehitEfxPosition().y;

                    Vector3 lookRot = aimPos - flyTransform.position;

                    // 穿透的子弹不需要考虑高度
                    if (m_fireFlyAttackDesc.bThroughFlag)
                    {
                        lookRot.y = 0;  // 设置为0时 高度不同时就打不到了
                    }
                    if (lookRot == Vector3.zero)
                    {
                        return;
                    }
                    lookRot.Normalize();
                    objBullet.transform.rotation = Quaternion.LookRotation(lookRot);

                    targetpos = aimPos;
                }
                else
                {
                    if (i == 0)
                    {
                        //朝向
                        Quaternion rot =
                            Quaternion.Euler(m_transform.rotation.eulerAngles.x,
                                             m_transform.rotation.eulerAngles.y + diffAngle * i, m_transform.rotation.eulerAngles.z);

                        objBullet.transform.rotation = rot;
                    }


                    if (i % 2 == 0)
                    {
                        //朝向
                        Quaternion rot =
                            Quaternion.Euler(m_transform.rotation.eulerAngles.x,
                                             m_transform.rotation.eulerAngles.y + diffAngle * (i + 1) * 0.5f, m_transform.rotation.eulerAngles.z);

                        objBullet.transform.rotation = rot;
                    }
                    else
                    {
                        //朝向
                        Quaternion rot =
                            Quaternion.Euler(m_transform.rotation.eulerAngles.x,
                                             m_transform.rotation.eulerAngles.y - diffAngle * (i + 1) * 0.5f, m_transform.rotation.eulerAngles.z);

                        objBullet.transform.rotation = rot;
                    }
                }

                // 弹弹乐
                TanTanLe tantan = objBullet.GetComponent <TanTanLe>();
                if (tantan != null)
                {
                    BulletParam param = new BulletParam();
                    param.flySpeed            = m_fireFlyAttackDesc.flySpeed;
                    param.flyTime             = m_fireFlyAttackDesc.flyTime;
                    param.skillID             = m_skillBase.m_skillID;
                    param.castObj             = m_skillBase.m_actor.thisGameObject;
                    param.damageActorTypeList = m_fireFlyAttackDesc.aimActorTypeList;

                    param.bThroughFlag  = m_fireFlyAttackDesc.bThroughFlag;
                    param.projectile    = m_fireFlyAttackDesc.projectile;
                    param.TanTanLeCount = m_fireFlyAttackDesc.TanTanLeCount;
                    param.TanTanLeDis   = m_fireFlyAttackDesc.TanTanLeDis;
                    param.dizzyTime     = m_fireFlyAttackDesc.dizzyTime;

                    param.targetpos = targetpos;
                    if (m_skillBase != null && m_skillBase.m_actor != null)
                    {
                        ActorObj actorobj = m_skillBase.m_hitActor;
                        if (actorobj != null)
                        {
                            param.aimTransform = actorobj.transform;
                        }
                        else
                        {
                            actorObj = m_skillBase.m_actor.GetAttackObj();
                            if (actorObj == null)
                            {
                                actorObj = m_skillBase.m_hitActor;
                            }
                            if (actorobj != null)
                            {
                                param.aimTransform = actorobj.transform;
                            }
                            {
                                ActorObj gameobj = m_skillBase.GetSelTarget();
                                if (gameobj != null)
                                {
                                    param.aimTransform = gameobj.transform;
                                }
                            }
                        }
                    }
                    tantan.Init(param);
                }
                else // 子弹
                {
                    Bullet      bullet = objBullet.GetComponent <Bullet>();
                    BulletParam param  = new BulletParam();

                    param.m_skillBase = m_skillBase;

                    param.flySpeed            = m_fireFlyAttackDesc.flySpeed;
                    param.flyTime             = m_fireFlyAttackDesc.flyTime;
                    param.skillID             = m_skillBase.m_skillID;
                    param.castObj             = m_skillBase.m_actor.thisGameObject;
                    param.damageActorTypeList = m_fireFlyAttackDesc.aimActorTypeList;

                    param.bThroughFlag              = m_fireFlyAttackDesc.bThroughFlag;
                    param.projectile                = m_fireFlyAttackDesc.projectile;
                    param.targetpos                 = targetpos;
                    param.bTakeAwayTarget           = m_fireFlyAttackDesc.bTakeAwayTarget;
                    param.disappearWhenTouchWall    = m_fireFlyAttackDesc.disappearWhenTouchWall;
                    param.bCanNotMoveWhenTakenAway  = m_fireFlyAttackDesc.bCanNotMoveWhenTakenAway;
                    param.bTraceTarget              = m_fireFlyAttackDesc.bTraceTarget;
                    param.bAttachToSkill            = m_fireFlyAttackDesc.bAttachToSkill;
                    param.bAttackMoreThanOnce       = m_fireFlyAttackDesc.bAttackMoreThanOnce;
                    param.bEndTheSkillWhenDisappear = m_fireFlyAttackDesc.bEndTheSkillWhenDisappear;
                    bullet.Init(param);
                }
            }
        }