/// <summary>
    /// 计算由 目标位置确定的区域特效 位置
    /// </summary>
    /// <param name="targetData">目标位置数据</param>
    /// <param name="effectPos">特效计算前的位置-释放者特效绑点的位置</param>
    /// <returns></returns>
    protected Vector3 GetTargetAreaPos(Games.SkillModle.SkillCore.SkillTargetData targetData, Vector3 effectPos)
    {
        Vector3 res = effectPos;

        if (targetData != null)
        {
            res.x = targetData._targetPos.x;
            res.z = targetData._targetPos.z;
        }
        return(res);
    }
    protected void LoadEffectComplete(LoadedObjData resObj, AddEffectData parameter1)
    {
        AddEffectData curData = parameter1;

        if (curData == null)
        {
            return;
        }
        Object loadedObj = resObj.LoadedObj;

        if (loadedObj == null)
        {
            LogModule.ErrorLog("add effect error:");
            if (null != curData._delPlayEffect)
            {
                curData._delPlayEffect(null, curData._param);
            }
            return;
        }
        if (null == curData._effectData)
        {
            LogModule.ErrorLog("effectData is null");
            if (null != curData._delPlayEffect)
            {
                curData._delPlayEffect(null, curData._param);
            }
            return;
        }
        if (null == curData._parentObj)
        {
            LogModule.DebugLog("curData._parentObj is null");
            if (null != curData._delPlayEffect)
            {
                curData._delPlayEffect(null, curData._param);
            }
            return;
        }
        if (!m_NeedPlayEffectIdCacheList.Contains(curData._effectData.EffectID))
        {
            if (null != curData._delPlayEffect)
            {
                curData._delPlayEffect(null, curData._param);
            }
            return;
        }

        GameObject effectObj = GameObject.Instantiate(loadedObj) as GameObject;

        if (null == effectObj)
        {
            if (null != curData._delPlayEffect)
            {
                curData._delPlayEffect(null, curData._param);
            }
            return;
        }

        GameObject fxController = ResourceManager.InstantiateResource("Prefab/Effect/FXController") as GameObject;

        if (null == fxController)
        {
            GameObject.Destroy(effectObj);
            LogModule.ErrorLog("can't find prefab fxcontroller in Prefab/Effect/FXController");
            return;
        }
        FXController controllerComponent = fxController.GetComponent <FXController>();

        if (controllerComponent == null)
        {
            LogModule.ErrorLog("can not find fxcontroller on gameobject");
            GameObject.Destroy(fxController);
            GameObject.Destroy(effectObj);
            if (null != curData._delPlayEffect)
            {
                curData._delPlayEffect(null, curData._param);
            }
            return;
        }
        controllerComponent.m_Path = resObj.Url;
        ResourcesManager.Instance.AddCachedRef(controllerComponent.m_Path, EResourceType.Effect);
        m_NeedPlayEffectIdCacheList.Remove(curData._effectData.EffectID);
        effectObj.SetActive(false);

        if (null != curData._parentObj)
        {
            Utils.SetParent(fxController.transform, curData._parentObj.transform);
        }
        Utils.SetParent(effectObj.transform, fxController.transform);
        effectObj.transform.localPosition = new Vector3(curData._effectData.X, curData._effectData.Y,
                                                        curData._effectData.Z);
        effectObj.transform.localRotation =
            Quaternion.Euler(curData._effectData.RotationX, curData._effectData.RotationY,
                             curData._effectData.RotationZ);
        if (curData._effectData.Type == (int)EEffectChangeType.TYPE_TARGETAREA)
        {
            //add 由目标位置确定的区域特效
            Games.SkillModle.SkillCore.SkillTargetData targetData = curData._param as Games.SkillModle.SkillCore.SkillTargetData;
            if (targetData != null && targetData._hasSet)
            {
                Vector3 cacPos = effectObj.transform.position;
                cacPos = GetTargetAreaPos(targetData, cacPos);
                effectObj.transform.position = cacPos;
            }
        }

        controllerComponent.OnlyDeactivate = curData._effectData.IsOnlyDeactive;
        controllerComponent.Delay          = curData._effectData.DelayTime;
        controllerComponent.Duration       = curData._effectData.Duration;
        controllerComponent.EffectGameObj  = m_EffectGameObj;
        controllerComponent.IsFellowOwner  = curData._effectData.IsFellowOwner;
        controllerComponent.EffectID       = curData._effectData.EffectID;
        controllerComponent.Play(this);

        //进行一些特效的额外索引
        OnAddEffectComplete(curData);

        if (null != curData._delPlayEffect)
        {
            curData._delPlayEffect(effectObj, curData._param);
        }
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="parentObj"></param>
    /// <param name="effectData"></param>
    /// <param name="delPlayEffect"></param>
    /// <param name="param"></param>
    protected void AddEffect(GameObject parentObj, Tab_Effect effectData, PlayEffectDelegate delPlayEffect,
                             object param)
    {
        if (null == effectData)
        {
            LogModule.ErrorLog("effectData is null");
            if (null != delPlayEffect)
            {
                delPlayEffect(null, param);
            }
            return;
        }
        ChangeMaterialColor(effectData.Type);

        //已经存在 数量加1
        if (m_EffectCountCache.ContainsKey(effectData.EffectID))
        {
            m_EffectCountCache[effectData.EffectID] = m_EffectCountCache[effectData.EffectID] + 1;
        }
        //不存在 添加进去 数量为1
        else
        {
            m_EffectCountCache.Add(effectData.EffectID, 1);
        }

        if (effectData.IsOnlyDeactive && m_dicEffectCache.ContainsKey(effectData.EffectID) && m_dicEffectCache[effectData.EffectID].Count > 0)
        {
            FXController curFXController = m_dicEffectCache[effectData.EffectID][0];
            m_dicEffectCache[effectData.EffectID].RemoveAt(0);
            if (curFXController)
            {
                //区域特效单独处理
                if (effectData.Type == (int)EEffectChangeType.TYPE_TARGETAREA)
                {
                    Games.SkillModle.SkillCore.SkillTargetData targetData = param as Games.SkillModle.SkillCore.SkillTargetData;
                    if (targetData != null)
                    {
                        if (targetData._hasSet)
                        {
                            curFXController.ChangePositionForAreaEffect(GetTargetAreaPos(targetData, curFXController.GetPosition()));
                        }
                        else
                        {
                            curFXController.ResetAreaEffect();
                        }
                    }
                }
                curFXController.Play(this);
            }

            if (null != delPlayEffect)
            {
                delPlayEffect(curFXController.m_FirstChild, param);
            }
            return;
        }

        AddEffectData curData = new AddEffectData(parentObj, effectData, delPlayEffect, param);

        m_NeedPlayEffectIdCacheList.Add(effectData.EffectID);
        //凑活的方式 如果 该粒子没有在
        GameObject resObj = ResourceManager.LoadResource(effectData.Path) as GameObject;

        if (null != resObj)
        {
            LoadEffectComplete(new LoadedObjData()
            {
                LoadedObj = resObj
            }, curData);
            return;
        }

        BundleManager.LoadEffectInQueue(effectData.EffectID, LoadEffectComplete, curData);
    }