Exemple #1
0
        /// <summary>
        /// 添加技能特效。
        /// </summary>
        /// <param name="actioncfg">技能效果配置。</param>
        public static void AddSkillEffect(LuaTable actioncfg)
        {
            //技能特效
            if (SkillEffect != null)
            {
                CoreEntry.gGameObjPoolMgr.Destroy(SkillEffect);
            }

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

            if (!string.IsNullOrEmpty(actionEfx))
            {
                SkillEffect = CoreEntry.gGameObjPoolMgr.InstantiateEffect(actionEfx);
                if (SkillEffect != null)
                {
                    EfxAttachActionPool efx = SkillEffect.GetComponent <EfxAttachActionPool>();
                    if (efx == null)
                    {
                        efx = SkillEffect.AddComponent <EfxAttachActionPool>();
                    }

                    Transform player = CurModeShow.mPlayerObject.transform;
                    Transform eft    = SkillEffect.transform;
                    efx.Init(player, actioncfg.Get <float>("skillEfxLength"), false);
                    if (actioncfg.Get <bool>("isBind"))
                    {
                        Transform bindTran;
                        string    hangpoint = actioncfg.Get <string>("hangPoint");
                        if (!string.IsNullOrEmpty(hangpoint))
                        {
                            bindTran = player.transform.DeepFindChild(hangpoint);
                            if (null == bindTran)
                            {
                                bindTran = player;
                            }
                        }
                        else
                        {
                            bindTran = player;
                        }

                        eft.SetParent(bindTran);
                        eft.localPosition = Vector3.zero;
                        eft.localScale    = Vector3.one;
                        eft.localRotation = Quaternion.identity;
                    }
                    else
                    {
                        eft.SetParent(player.parent);
                        eft.position   = player.position;
                        eft.localScale = Vector3.one;
                        eft.rotation   = player.rotation;
                    }
                }
            }
        }
Exemple #2
0
        public void Init(ActorObj attackObj, ActorObj beHitObj, int skillID, bool onlyShowSkillScope = false)
        {
            //-------------------Init---------------------
            m_actor     = null;
            m_skillDesc = null;

            //技能释放结束时间
            m_overTime = 0;

            m_strActionName    = "";   //动作名
            m_speed            = 1.0f; //动作播放速度
            m_startPlayTimeSet = 0;    //动作开始播放时间

            m_actionEfx = null;

            //m_RemainEfx = null;

            m_attachEfxObjectlist.Clear();
            m_skillCellObjectlist.Clear();
            attachingBulletList.Clear();
            m_prepareKeepTime = 0;
            m_bIsAoe          = true;
            //----------------------------------------------

            m_skillID  = skillID;
            m_actor    = attackObj;
            m_hitActor = beHitObj;

            m_skillDesc   = m_actor.GetCurSkillDesc(m_skillID);
            m_skilleffect = null;
            if (null != m_skillDesc && m_skillDesc.Get <int>("e_type_1") != (int)SkillEffectType.CUSTOM)
            {
                m_skilleffect = ConfigManager.Instance.Skill.GetEffectConfig(m_skillDesc.Get <int>("effect_1"));
            }

            m_startPlayTimeSet = m_actor.m_actionStartPlayTime;

            m_onlyShowSkillScope          = onlyShowSkillScope;
            shouldUpdatePositionToCastObj = true;

            SubSkill = false;

            //防止出现普攻打击频率出错的问题
            canMove    = false;
            canBeBroke = true;
            IsOver     = false;

            //跟技能释放者同步位置
            Syncm_transform();
        }
Exemple #3
0
        //接受事件
        public override void OnEvent(SkillCellEventType eventType, params ValueArg[] valueArgs)
        {
            switch (eventType)
            {
            case SkillCellEventType.SE_DESTROY_ACTION_EFX:
            {
                if (m_actionEfx != null)
                {
                    m_actionEfx.DestoryObject();
                    m_actionEfx = null;
                }
            }
            break;

            default:
                break;
            }
        }
Exemple #4
0
        protected void AutoEnd(Transform tTransform)
        {
            CancelInvoke("AutoEnd");
            bAutoEnd = true;

            //是否需要残留

            //地表残留
            //LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_param.m_skillBase.m_skillID);
            LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_param.m_skillBase.m_skillID);

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

                if (remanEfx.Length > 0)
                {
                    //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_param.m_skillBase.m_actor.actorCreatureDisplayDesc.sacle > 1.0f)
                    //{
                    //    ParticleScaler ScaleComponet = efxObj.GetComponent<ParticleScaler>();
                    //    if (ScaleComponet == null)
                    //        ScaleComponet = efxObj.AddComponent<ParticleScaler>();

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

                    //}


                    float maxEfxTime = 0;
                    NcCurveAnimation[] efxAnimations = efxObj.GetComponentsInChildren <NcCurveAnimation>();
                    for (int i = 0; i < efxAnimations.Length; ++i)
                    {
                        float efxTime = efxAnimations[i].m_fDelayTime + efxAnimations[i].m_fDurationTime;
                        if (efxTime > maxEfxTime)
                        {
                            maxEfxTime = efxTime;
                        }
                    }

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

                    //特效存在时间
                    if (maxEfxTime <= 0.001)
                    {
                        maxEfxTime = m_param.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(transform, maxEfxTime, false);

                    Invoke("DestoryEfx", maxEfxTime);

                    m_RemainEfx = efx;
                }
            }


            DisableTakeWayEffect();
            ProcessAutoEnd();

            SetActiveMeshRender(false);
            Destroy(this.gameObject, 1.5f);
        }
Exemple #5
0
        void Start()
        {
            CancelInvoke("Start");

            if (m_skillBase == null || m_skillBase.m_actor == null)
            {
                return;
            }

            m_skillBase.m_actor.ReqirueCanNotBeControlledByInput();

            //主角在电梯上禁止美术位移
            if (CoreEntry.gSceneMgr.IsPlayerOnElevator())
            {
                return;
            }

            if (m_movePosAttackDesc == null)
            {
                return;
            }

            LuaTable skillDesc = m_skillBase.m_actor.GetCurSkillDesc(m_skillBase.m_skillID);

            if (skillDesc == null)
            {
                LogMgr.UnityError("non SkillDesc! " + m_skillBase.m_skillID);
                return;
            }

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

            //计算位移距离
            m_distance = m_movePosAttackDesc.moveDistance;

            //使用目标的位置, 前面0.5米

            if (m_skillBase.m_actor.IsMainPlayer())
            {
                if (m_skillBase.m_actor.m_SelectTargetObject != null)
                {
                    float dist1 = Vector3.Distance(transform.position, m_skillBase.m_actor.m_SelectTargetObject.transform.position) - 0.5f;
                    if (dist1 > m_distance)
                    {
                        dist1 = m_distance;
                    }

                    m_distance = dist1;
                }
            }

            float resetDistance = m_distance;

            //设置位移
            do
            {
                ActorObj ActorObj = m_skillBase.m_actor.GetAttackObj();
                if (ActorObj == null)
                {
                    ActorObj = m_skillBase.m_hitActor;
                }

                if (ActorObj == null)
                {
                    LogMgr.UnityLog("CurveMove:no target");
                    break;
                }

                GameObject targetObj = ActorObj.thisGameObject;
                if (targetObj == null)
                {
                    LogMgr.UnityLog("CurveMove:no target");
                    break;
                }

                ActorObj targetActorBase = targetObj.GetComponent <ActorObj>();
                if (targetActorBase == null)
                {
                    LogMgr.UnityError("CurveMove:no actorbase");
                    break;
                }


                if (m_movePosAttackDesc.isStopForTarget)
                {
                    float fDistTo = m_skillBase.m_actor.GetColliderRadius() + targetObj.GetComponent <ActorObj>().GetColliderRadius();

                    if (CoreEntry.gGameMgr.IsPvpState())
                    {
                        fDistTo += 1.2f;
                    }


                    //不可以穿透,重置位移大小
                    float aimDistance = Vector3.Distance(m_transform.position, targetObj.transform.position) - fDistTo - 0.2f;    //两个物体间的距离

                    //范围内,不需要位移
                    if (aimDistance <= 0)
                    {
                        //Debug.LogWarning("CurveMove: don't need excute!");
                        return;
                    }

                    resetDistance = Mathf.Min(aimDistance, resetDistance);
                }
                else
                {
                    resetDistance = m_distance;
                }
            } while (false);



            Quaternion r0  = Quaternion.Euler(m_transform.eulerAngles);
            Vector3    pos = m_transform.position +
                             r0 * Vector3.forward * resetDistance;

            //找到对应地面上的点
            Vector3 aimPos = m_baseTool.GetGroundPoint(pos);

            if (aimPos.Equals(Vector3.zero))
            {
                return;
            }

            Vector3 dstDir = aimPos - m_transform.position;

            dstDir.Normalize();

            //左手方向
            //Vector3 leftDir = Quaternion.Euler(new Vector3(0, 90, 0)) * dstDir;
            //Vector3 rightDir = Quaternion.Euler(new Vector3(0, -90, 0)) * dstDir;
            //Vector3 backDir = Quaternion.Euler(new Vector3(0, 180, 0)) * dstDir;

            //float dstDistance = Vector3.Distance(m_transform.position, aimPos);
            m_needMove = true;

            //向上移动点
            //aimPos += new Vector3(0, 0.2f, 0);
            aimPos = m_baseTool.GetLineReachablePos(m_transform.position, aimPos);
            aimPos = m_baseTool.GetGroundPoint(aimPos);

            if (m_skillBase.m_actor.IsMainPlayer())
            {
                m_dstPos = aimPos;
            }
            else
            {
                m_dstPos = m_skillBase.m_actor.m_CurveMovePos;
            }

            //使用曲线
            CurveMoveParam param = new CurveMoveParam();

            param.aimActorTypeList = m_movePosAttackDesc.resetAimActorTypeList;
            param.isCarryOffTarget = m_movePosAttackDesc.isCarryOffTarget;
            param.isStopForTarget  = m_movePosAttackDesc.isStopForTarget;

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

            if (skill_action != null)
            {
                m_uuid = m_skillBase.m_actor.UseCurveData3(skill_action.Get <string>("animation"), m_dstPos,// m_dstPos,
                                                           param);
            }

            m_param = param;

            //拖尾特效
            if (m_movePosAttackDesc.efxPrefab.Length > 0)
            {
                //GameObject efxObj = Instantiate(CoreEntry.gResLoader.LoadResource(m_movePosAttackDesc.efxPrefab)) as GameObject;
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(m_movePosAttackDesc.efxPrefab);

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

                float efxTime = 1.0f;
                if (skill_action != null)
                {
                    m_skillBase.m_actor.GetLeftActionTime(skill_action.Get <string>("animation"));
                }

                efx.Init(m_skillBase.m_actor.transform, efxTime);
            }
        }
Exemple #6
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 #7
0
        //播放动画,特效,声音
        IEnumerator PlayActionEfxSound(SkillPlayParam param, float delayTime)
        {
            if (m_actor == null)
            {
                yield  break;
            }
            m_strActionName = param.action;
            if (m_strActionName != null && m_strActionName.Length > 0)
            {
                //动作带位移 的 不能延迟播放,  延迟播放将影响 位移曲线计算
                m_actor.PlayAction(m_strActionName, false);
                m_actor.SetActionTime(m_strActionName, param.startTime);
                m_actor.SetSkillActionSpeed(m_strActionName, param.speed, m_skillDesc);
            }

            //其它玩家不播放了
            if (m_actor.mActorType == ActorType.AT_REMOTE_PLAYER)
            {
                yield break;
            }

            if (m_actor.mActorType == ActorType.AT_PET)
            {
                PetObj pet = m_actor as PetObj;
                if (null != pet && pet.m_MasterActor != CoreEntry.gActorMgr.MainPlayer)
                {
                    yield break;
                }
            }

            //播放声音
            string sound1 = param.sound;
            string sound2 = param.voice;

            if (sound1 != null && sound1.Length > 0)
            {
                m_actor.StopSound();
                m_actor.PlaySound(sound1);
            }

            if (sound2 != null && sound2.Length > 0)
            {
                m_actor.StopSound2();
                m_actor.PlaySound2(sound2);
            }

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

            if (skill_action == null)
            {
                Debug.LogError("==skill_action == is null m_skillID = " + m_skillID);
                yield break;
            }
            Vector3 efxPos   = m_actor.transform.position;
            bool    isBind   = skill_action.Get <bool>("isBind");
            int     bindType = skill_action.Get <int>("skillEfxPos");

            if (!isBind)
            {
                if (bindType == 1)
                {
                    ActorObj target = m_actor.GetSelTarget();
                    if (null != target)
                    {
                        efxPos = target.transform.position;
                    }
                }
            }

            if (delayTime > 0.0001f)
            {
                yield return(new WaitForSeconds(delayTime));
            }

            //if (ByteToString.toString(m_skillDesc.szAttackEfxPrefab).Length > 0)
            if (param.actionEfx != null && param.actionEfx.Length > 0)
            {
                if (/*m_skillDesc.skilltype == 0 && */ m_actor.mActorType == ActorType.AT_BOSS)
                {
                    yield return(new WaitForSeconds(m_actor.NoramalAttackEffectDelayTime));
                }
                if (skill_action != null)
                {
                    param.actionEfx = skill_action.Get <string>("skilleffect");
                    //efxObj = Instantiate(CoreEntry.gResLoader.LoadResource(param.actionEfx)) as GameObject;//CoreEntry.gGameObjPoolMgr.InstantiateEffect(param.actionEfx);
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(param.actionEfx);
                    if (efxObj == null)
                    {
                        LogMgr.LogError("找不到attackEfxPrefab:" + skill_action.Get <string>("skilleffect") + " " + m_skillDesc.Get <string>("name"));
                    }
                }

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


                //LogMgr.UnityLog("maxEfxTime=" + maxEfxTime + ", " + m_strActionName);

                //特效存在时间
                if (maxEfxTime <= 0.001)
                {
                    maxEfxTime = m_actor.GetActionLength(m_strActionName);

                    if (maxEfxTime <= 0.001)
                    {
                        LogMgr.UnityError("技能 动作时间 没有配置 skillID:" + m_skillDesc.Get <int>("id"));
                    }
                }


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

                if (efx != null)
                {
                    efx.Init(m_actor.transform, maxEfxTime, isFollowMove);

                    m_actionEfx = efx;

                    if (isBind)
                    {
                        ActorObj bindActor = null;
                        if (bindType == 0)
                        {
                            bindActor = m_actor;
                        }
                        else
                        {
                            bindActor = m_actor.GetSelTarget();
                        }

                        Transform bindTran = null;
                        if (null != bindActor)
                        {
                            string hangPoint = skill_action.Get <string>("hangPoint");
                            if (!string.IsNullOrEmpty(hangPoint))
                            {
                                bindTran = bindActor.transform.FindChild(hangPoint);
                            }
                            if (null == bindTran)
                            {
                                bindTran = bindActor.transform;
                            }
                        }
                        else
                        {
                            bindTran = m_actor.transform;
                        }

                        m_actionEfx.transform.parent        = bindTran;
                        m_actionEfx.transform.localPosition = Vector3.zero;
                        m_actionEfx.transform.localScale    = Vector3.one;
                        m_actionEfx.transform.rotation      = m_actor.transform.rotation;
                    }
                    else
                    {
                        if (bindType == 1)
                        {
                            m_actionEfx.transform.position = efxPos;
                        }
                        else
                        {
                            m_actionEfx.transform.position = m_actor.transform.position;
                        }
                        m_actionEfx.transform.localScale = Vector3.one;
                        m_actionEfx.transform.rotation   = m_actor.transform.rotation;
                    }

                    //设置有挂点的特效
                    Transform[] childTransform = efxObj.GetComponentsInChildren <Transform>();
                    //foreach (Transform childTrans in childTransform)
                    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)
                        {
                            childTrans.parent        = parent;
                            childTrans.localPosition = Vector3.zero;
                            childTrans.localRotation = Quaternion.identity;
                            childTrans.localScale    = Vector3.one;

                            m_attachEfxObjectlist.Add(childTrans.gameObject);
                        }
                    }

                    //影子
                    ghostMesh[] ghostMesh = efx.GetComponentsInChildren <ghostMesh>();

                    if (ghostMesh.Length > 0)
                    {
                        SkinnedMeshRenderer MianSkinMesh = m_actor.m_skinnedMeshRenderer[0];
                        for (int i = 0; i < m_actor.m_skinnedMeshRenderer.Length; ++i)
                        {
                            if (m_actor.m_skinnedMeshRenderer[i].name.Contains("weapon"))
                            {
                                continue;
                            }
                            MianSkinMesh = m_actor.m_skinnedMeshRenderer[i];
                        }

                        for (int i = 0; i < ghostMesh.Length; ++i)
                        {
                            ghostMesh[i].characterMesh[0] = MianSkinMesh;
                        }
                    }
                }
            }

            yield return(1);
        }
Exemple #8
0
        private void ShowBossSkillWarning()
        {
            if (null == m_actor || m_actor.mActorType != ActorType.AT_BOSS)
            {
                return;
            }

            if (null == m_skillDesc || null == m_skilleffect)
            {
                return;
            }

            int castSkillType = m_skillDesc.Get <int>("faction_limit");

            if (castSkillType == 2)
            {
                return;
            }
            castSkillType = m_skillDesc.Get <int>("subtype");
            if (castSkillType < (int)SkillType.SKILL_CHARGE || castSkillType > (int)SkillType.SKILL_BIGAOE)
            {
                LogMgr.UnityError(string.Format("skill:{0} has an invalid skill subtype:{1}", m_skillID, castSkillType));

                return;
            }
            if (castSkillType == (int)SkillType.SKILL_NORMAL)
            {
                return;
            }

            int rangeType = m_skilleffect.Get <int>("range");
            int param1    = m_skilleffect.Get <int>("distance");
            int param2    = m_skilleffect.Get <int>("angle");

            GameObject efxObj = null;
            Vector3    pos;
            bool       isRectWarning = false;

            if (rangeType == (int)SkillRangeType.SKILL_TARGET || rangeType == (int)SkillRangeType.SKILL_TARGET_CIRCLE)
            {
                ActorObj target = m_actor.GetSelTarget();
                if (null == target)
                {
                    return;
                }

                pos    = target.transform.position;
                efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect("Effect/skill/remain/fx_yujing_yuan");
                if (null != efxObj)
                {
                    efxObj.transform.localRotation = Quaternion.identity;
                    efxObj.transform.localScale    = new Vector3(param1 * 2.0f, 1.0f, param1 * 2.0f);
                }
            }
            else
            {
                pos = m_actor.transform.position;

                if (rangeType == (int)SkillRangeType.SKILL_SELF_FUN)
                {
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect("Effect/skill/remain/fx_yujing_shanxing");
                    if (null != efxObj)
                    {
                        efxObj.transform.rotation   = m_actor.transform.rotation;
                        efxObj.transform.localScale = new Vector3(param1, 1.0f, param1);
                    }
                }
                else if (rangeType == (int)SkillRangeType.SKILL_SELF_RECT)
                {
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect("Effect/skill/remain/fx_yujing_changfang");
                    if (null != efxObj)
                    {
                        efxObj.transform.rotation   = m_actor.transform.rotation;
                        efxObj.transform.localScale = new Vector3(param2, 1.0f, param1);
                    }
                    isRectWarning = true;
                }
                else if (rangeType == (int)SkillRangeType.SKILL_SELF_CIRCLE)
                {
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect("Effect/skill/remain/fx_yujing_yuan");
                    if (null != efxObj)
                    {
                        efxObj.transform.localRotation = Quaternion.identity;
                        efxObj.transform.localScale    = new Vector3(param1 * 2.0f, 1.0f, param1 * 2.0f);
                    }
                }
            }

            if (null == efxObj)
            {
                return;
            }

            efxObj.transform.position = pos;

            int delayTime           = m_skilleffect.Get <int>("delay");
            EfxAttachActionPool efx = efxObj.GetComponent <EfxAttachActionPool>();

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

            if (efx != null)
            {
                efx.Init(null, delayTime * 0.001f + 0.5f);
            }

            Transform aniTransform = efxObj.transform.FindChild("liquan");

            if (null != aniTransform)
            {
                if (isRectWarning)
                {
                    aniTransform.localPosition = Vector3.zero;
                    TweenPosition.Begin(aniTransform.gameObject, delayTime * 0.001f, Vector3.forward);
                }
                else
                {
                    aniTransform.localScale = Vector3.zero;
                    TweenScale.Begin(aniTransform.gameObject, delayTime * 0.001f, Vector3.one);
                }
            }
        }
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 DoAction()
        {
            //播放动作,特效
            if (m_actionCellDesc.name.Length > 0)
            {
                m_actor.PlayAction(m_actionCellDesc.name, false);
                m_actor.SetActionTime(m_actionCellDesc.name, m_actionCellDesc.setStartTime);
                m_actor.SetActionSpeed(m_actionCellDesc.name, m_actionCellDesc.speed);
            }

            //播放声音
            string sound1 = "";
            string sound2 = "";
            bool   ret1   = AudioCore.GenerateAudio(m_actionCellDesc.sound1, ref sound1);
            bool   ret2   = AudioCore.GenerateAudio(m_actionCellDesc.sound2, ref sound2);

            if (ret1 && sound1.Length > 0)
            {
                m_actor.StopSound();
                m_actor.PlaySound(sound1);
            }

            if (ret2 && sound2.Length > 0)
            {
                m_actor.StopSound2();
                m_actor.PlaySound2(sound2);
            }

            if (m_actionCellDesc.efx.Length > 0)
            {
                //GameObject efxObj = Instantiate(
                //    CoreEntry.gResLoader.LoadResource(m_actionCellDesc.efx)) as GameObject;
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(m_actionCellDesc.efx);

                float maxEfxTime = 0;
                NcCurveAnimation[] efxAnimations = efxObj.GetComponentsInChildren <NcCurveAnimation>();
                for (int i = 0; i < efxAnimations.Length; ++i)
                {
                    efxAnimations[i].m_fDelayTime    /= m_actionCellDesc.speed;
                    efxAnimations[i].m_fDurationTime /= m_actionCellDesc.speed;

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

                LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillBase.m_skillID);
                if (skill_action != null && skill_action.Get <float>("skillEfxLength") > 0)
                {
                    maxEfxTime = skill_action.Get <float>("skillEfxLength");
                }

                //LogMgr.UnityLog("maxEfxTime=" + maxEfxTime + ", " + m_strActionName);

                //特效存在时间
                if (maxEfxTime <= 0.001)
                {
                    maxEfxTime = 5;
                }

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

                m_actionEfx = efx;

                if (m_actionCellDesc.shouldAttachToOwner)
                {
                    efx.Init(m_skillBase.m_actor.transform, maxEfxTime);

                    //设置有挂点的特效
                    Transform[] childTransform = efxObj.GetComponentsInChildren <Transform>();
                    foreach (Transform childTrans in childTransform)
                    {
                        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)
                        {
                            childTrans.parent        = parent;
                            childTrans.localPosition = Vector3.zero;
                            childTrans.localRotation = Quaternion.identity;
                            childTrans.localScale    = Vector3.one;

                            if (m_attachEfxObjectlist == null)
                            {
                                m_attachEfxObjectlist = new List <GameObject>();
                            }
                            m_attachEfxObjectlist.Add(childTrans.gameObject);
                        }
                    }

                    //影子
                    ghostMesh[] ghostMesh = efx.GetComponentsInChildren <ghostMesh>();

                    SkinnedMeshRenderer MianSkinMesh = m_actor.m_skinnedMeshRenderer[0];
                    for (int i = 0; i < m_actor.m_skinnedMeshRenderer.Length; ++i)
                    {
                        if (m_actor.m_skinnedMeshRenderer[i].name.Contains("weapon"))
                        {
                            continue;
                        }
                        MianSkinMesh = m_actor.m_skinnedMeshRenderer[i];
                    }

                    for (int i = 0; i < ghostMesh.Length; ++i)
                    {
                        ghostMesh[i].characterMesh[0] = MianSkinMesh;
                    }
                }
                else
                {
                    efx.Init(m_skillBase.transform, maxEfxTime, false);
                    efx.transform.parent = m_skillBase.transform;
                    BaseTool.ResetTransform(efx.transform);
                }
            }
        }
Exemple #11
0
        public override void OnExit()
        {
            base.OnExit();

            //boneEffect = GameObject.Instantiate(CoreEntry.gResLoader.LoadResource(effectPath)) as GameObject;
            if (string.IsNullOrEmpty(effectPath))
            {
                return;
            }
            boneEffect = CoreEntry.gGameObjPoolMgr.InstantiateEffect(effectPath);

            if (boneEffect == null)
            {
                return;
            }

            EfxAttachActionPool efx = boneEffect.GetComponent <EfxAttachActionPool>();

            if (efx == null)
            {
                efx = boneEffect.AddComponent <EfxAttachActionPool>();
            }
            //if (effectDesc.fParam[1]!=0)
            //    efx.Init(null, effectDesc.fParam[1]);
            //else
            efx.Init(null, 2f); // 默认两秒

            if (sBindPos != "")
            {
                // 取得所有子Transform列表
                Transform[] transforms = owner.gameObject.GetComponentsInChildren <Transform>();
                for (int i = 0; i < transforms.Length; ++i)
                {
                    if (transforms[i].name == sBindPos)
                    {
                        refNode = transforms[i];
                        boneEffect.transform.parent        = transforms[i];
                        boneEffect.transform.localPosition = Vector3.zero;
                        boneEffect.transform.localRotation = Quaternion.identity;
                        break;
                    }
                }
            }
            else
            {
                refNode = owner.transform;
                boneEffect.transform.parent        = owner.transform;
                boneEffect.transform.localPosition = Vector3.zero;
                boneEffect.transform.localRotation = Quaternion.identity;
            }

            if (refNode == null) // 无绑定点
            {
                // 没有绑定点的特效不继承旋转
                refNode = owner.transform;
                boneEffect.transform.localPosition = new Vector3(refNode.transform.position.x, refNode.transform.position.y + 0.1f, refNode.transform.position.z);
                boneEffect.transform.localRotation = Quaternion.identity;
                boneEffect.transform.localScale    = refNode.transform.localScale;
            }

            // 延时销毁特效
            //GameObject.Destroy(boneEffect, effectDesc.fParam[0]);

            OnStealth(owner.m_bStealthState);
        }