Beispiel #1
0
    //播放受击特效
    public uint ReqPlayHitFx(string fx_name, Vector3 position, Vector3 rotation, Vector3 scale, int level = 0)
    {
        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            return(0);
        }
        if (string.IsNullOrEmpty(fx_name))
        {
            return(0);
        }
        string path = fx_name;// (FxDir + fx_name).Replace(".prefab", ".fx").ToLower();

        IEffect effect = null;

        rs.CreateEffect(ref path, ref effect, (obj) =>
        {
            if (obj == null)
            {
                Log.LogGroup("ZDY", "fx load failed: {0}", path);
                return;
            }
            if (obj.GetNodeTransForm() == null)
            {
                return;
            }
            DoPlay(obj.GetNodeTransForm().gameObject, position, rotation, scale);
        }, nLevel: level);
        return(effect.GetID());
    }
Beispiel #2
0
    /// <summary>
    /// //挂接特效
    /// </summary>
    /// <param name="fx_name"></param>
    /// <param name="attach_node">挂节点</param>
    /// <param name="position">偏移位置</param>
    /// <param name="scale">缩放</param>
    public uint ReqPlayFx(string fx_name, Transform attach_node, Vector3 position, Vector3 scale, int level = 0)
    {
        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            return(0);
        }
        string path = fx_name;

        if (fx_name.EndsWith(".prefab"))
        {//先做下对老的兼容
            path = (FxDir + fx_name).Replace(".prefab", ".fx").ToLower();
        }

        IEffect effect = null;

        rs.CreateEffect(ref path, ref effect, (obj) =>
        {
            if (obj == null)
            {
                Log.Error("ReqPlayFx obj ================ fx load failed: " + path);
                return;
            }
            if (obj.GetNodeTransForm() == null)
            {
                Log.Error("ReqPlayFx GetNodeTransForm ================ fx load failed: " + path);
                return;
            }
            DoPlay(obj.GetNodeTransForm().gameObject, attach_node, position, scale);
        }, nLevel: level);
        return(effect.GetID());
    }
Beispiel #3
0
    private void LoadEffect(string strEffect, int nCount = 1)
    {
        Engine.IRenderSystem  renderSys = Engine.RareEngine.Instance().GetRenderSystem();
        Engine.IEffect        effect    = null;
        List <Engine.IEffect> temp      = new List <IEffect>();

        for (int i = 0; i < nCount; i++)
        {
            renderSys.CreateEffect(ref strEffect, ref effect, null, Engine.TaskPriority.TaskPriority_Normal, true);
            temp.Add(effect);
        }


        for (int i = 0; i < nCount; i++)
        {
            renderSys.RemoveEffect(temp[i]);
        }
        temp.Clear();
    }
Beispiel #4
0
    void AddEffect(Vector3 pos, uint effectID)
    {
        FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(effectID);

        if (edb != null)
        {
            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return;
            }
            string path = resDB.strPath;


            Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
            if (rs == null)
            {
                return;
            }
            IEffect effect = null;
            rs.CreateEffect(ref path, ref effect, (obj) =>
            {
                if (obj == null)
                {
                    Log.Error("fx load failed: " + path);
                    return;
                }
                if (obj.GetNodeTransForm() == null)
                {
                    return;
                }
                obj.GetNodeTransForm().localPosition = pos;
                obj.GetNodeTransForm().localRotation = Quaternion.identity;
                obj.GetNodeTransForm().localScale    = Vector3.one;
                //DoPlay(obj.GetNodeTransForm().gameObject, position, rotation, scale);
            });
        }
    }
Beispiel #5
0
    void AddEffect(Vector3 pos)
    {
        uint             resID = 50054;
        ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(resID);

        if (resDB == null)
        {
            Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}");
            return;
        }
        string path = resDB.strPath;

        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            return;
        }

        if (effect != null)
        {
            effect.Release();
        }
        rs.CreateEffect(ref path, ref effect, (obj) =>
        {
            if (obj == null)
            {
                return;
            }
            if (obj.GetNodeTransForm() == null)
            {
                return;
            }
            obj.GetNodeTransForm().localPosition = pos;
            obj.GetNodeTransForm().localRotation = Quaternion.identity;
            obj.GetNodeTransForm().localScale    = Vector3.one;

            //Engine.Utility.Log.Error("--->>特效坐标:" + mainPlayer.GetPos());
            //DoPlay(obj.GetNodeTransForm().gameObject, position, rotation, scale);
        });
    }
Beispiel #6
0
    void OnActionEvent(ref string strEventName, ref string strAnimationName, float time, object param)
    {
        if (strEventName == "addEffect_scene" && strAnimationName == Client.EntityAction.ShowLog)
        {
            uint nEffectID          = (uint)param;
            table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(nEffectID);
            if (edb != null)
            {
                table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath);
                if (resDB != null)
                {
                    string       strPath       = resDB.strPath;
                    string       strAttachNode = edb.attachNode;
                    List <float> rotate        = edb.rotate;
                    //m_Avater.RenderObj.AddLinkEffect(ref strPath, ref strAttachNode,
                    //    new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]),
                    //    Quaternion.identity,
                    //    Vector3.one);
                    Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem();
                    Engine.IEffect       effect    = null;

                    Vector3 vecRotate        = new Vector3(rotate[0], rotate[1], rotate[2]);
                    UnityEngine.Quaternion q = new Quaternion();
                    q.eulerAngles = vecRotate;
                    renderSys.CreateEffect(ref strPath, ref effect, null, Engine.TaskPriority.TaskPriority_Normal, true);
                    effect.GetNode().SetLocalRotate(q);

                    Vector3 pos = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);
                    effect.GetNode().SetLocalPosition(pos);

                    m_CurShowEffect.Add(effect);
                }
            }
        }
        else if (strEventName == "addEffect_body" && strAnimationName == Client.EntityAction.ShowLog)
        {
            AssetBundle m_AssetBundle;



            uint nEffectID          = (uint)param;
            table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(nEffectID);
            if (edb != null)
            {
                table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath);
                if (resDB != null)
                {
                    string       strPath       = resDB.strPath;
                    string       strAttachNode = edb.attachNode;
                    List <float> rotate        = edb.rotate;

                    Vector3 vecRotate        = new Vector3(rotate[0], rotate[1], rotate[2]);
                    UnityEngine.Quaternion q = new Quaternion();
                    q.eulerAngles = vecRotate;

                    m_Avater.RenderObj.AddLinkEffect(ref strPath, ref strAttachNode,
                                                     new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]),
                                                     q,
                                                     Vector3.one);
                }
            }
        }


        if (strEventName == "standAni" && strAnimationName == Client.EntityAction.ShowLog)
        {
            m_bLockRotate = false;
            m_Avater.PlayAni(Client.EntityAction.Show, null, 0.3f, -1);
        }

        if (strEventName == "Dissolve" && strAnimationName == Client.EntityAction.ShowLog)
        {
            RenderObjHelper.BeginDissolveEffect(m_Avater.RenderObj);
        }

        //if(strEventName=="end" && strAnimationName == Client.EntityAction.ShowLog)
        //{
        //    m_bLockRotate = false;
        //    if (null != m_cam_animator)
        //    {
        //        m_cam_animator.SetInteger(m_istateChangeParamHash, 0);
        //    }
        //m_Avater.PlayAni(Client.EntityAction.Show, null, 0.3f, -1);
        //}
    }