示例#1
0
    public static GameObject AttachEffectDirect(SkillEffectInfo info)
    {
        GameObject tEffectObj = null;

        if (info.EffectAsset != null)
        {
            tEffectObj = Script_Util.CreateGameObjectByAsset(info.EffectAsset);
        }
        else
        {
            tEffectObj = Script_Util.CreateGameObjectByName(info.EffectName);
        }
        if (null != tEffectObj)
        {
            bool ret = Script_Util.AttachGameObjectDirect(info.EffectParent, tEffectObj.transform);
            if (ret)
            {
                tEffectObj.transform.localPosition = info.EffectPos;
                tEffectObj.transform.localRotation = Quaternion.Euler(info.EffectRot);
            }
            if (OnGetSkillSoundInfo != null)
            {
                SkillSoundInfo sInfo = OnGetSkillSoundInfo(info.EffectSoundId);
                if (sInfo != null)
                {
                    TriggerImpl.PlaySoundAtTarget(tEffectObj, sInfo);
                }
            }
            GameObject.Destroy(tEffectObj, Script_Util.ForceNotifyEffectTime(info.EffectLiftTime));
        }
        else
        {
            LogicSystem.GfxLog("AttachEffect effect create failed!");
        }
        return(tEffectObj);
    }