Пример #1
0
    /// <summary>
    /// 给没有实体的模型挂接特效
    /// </summary>   effect资源表id
    /// <param name="fxResID"></param>
    public void  AddLinkEffectWithoutEntity(uint fxResID)
    {
        if (m_RenderObj != null)
        {
            table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(fxResID);
            if (edb != null)
            {
                ufxid = fxResID;
                AddLinkEffect node = new AddLinkEffect();
                node.nFollowType = (int)edb.flowType;
                node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
                node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);
                Quaternion rot = new Quaternion();
                rot.eulerAngles = node.rotate;
                // 使用资源配置表
                table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath);
                if (resDB == null)
                {
                    Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                    return;
                }
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;

                m_RenderObj.AddLinkEffect(ref node.strEffectName, ref node.strLinkName, node.vOffset, rot, node.scale, (Engine.LinkFollowType)node.nFollowType);
            }
        }
    }
Пример #2
0
        void AddEffect(IEntity target, uint effectID)
        {
            FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(effectID);

            if (edb != null && target != null)
            {
                AddLinkEffect node = new AddLinkEffect();
                node.nFollowType = (int)edb.flowType;
                node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
                node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

                // 使用资源配置表
                ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
                if (resDB == null)
                {
                    Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                    return;
                }
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;
                if (edb.bFollowRole)
                {
                    if (node.strEffectName.Length != 0)
                    {
                        target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);
                    }
                }
            }
        }
Пример #3
0
        public static int AddEffect(IEntity en, int nEffectID)
        {
            if (en == null)
            {
                return(0);
            }
            //RemoveEffect(en, nEffectID);
            table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>((uint)nEffectID);
            if (edb != null)
            {
                AddLinkEffect          node  = new AddLinkEffect();
                table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath);
                if (resDB == null)
                {
                    Engine.Utility.Log.Error("找不到特效资源路径配置{0}", edb.resPath);
                }
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;
                node.nFollowType   = (int)edb.flowType;
                node.rotate        = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
                node.vOffset       = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;
                node.bIgnoreRide   = false; // 特效要挂在坐骑上
                node.scale         = Vector3.one;
                return((int)en.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node));
            }

            return(0);
        }
Пример #4
0
        public override void Play(ISkillAttacker attacker, SkillEffect se)
        {
            AttachFxNodeProp prop = m_NodeProp as AttachFxNodeProp;

            if (prop == null)
            {
                return;
            }
            int level = 0;

            if (attacker != null)
            {
                if (attacker.GetSkillPart() != null)
                {
                    level = attacker.GetSkillPart().FxLevel;
                }
            }
            skillMaster = attacker.GetGameObject();
            AddLinkEffect node = new AddLinkEffect();

            node.nFollowType = (int)0;
            node.rotate      = Vector3.zero;
            node.vOffset     = prop.offset_pos;
            node.nLevel      = level;
            //  string effectName = prop.fx_name.Replace( "prefab" , "fx" );
            // node.strEffectName = SkillEffectHelper.FxDir + effectName;
            node.strEffectName = prop.fx_name;
            node.strLinkName   = prop.attach_name;
            if (skillMaster != null)
            {
                effectID = (uint)(int)skillMaster.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);
            }
        }
Пример #5
0
        private object AddLinkEffect(object param)
        {
            if (m_Owner != null)
            {
                AddLinkEffect add = (AddLinkEffect)param;
                Quaternion    rot = new Quaternion();
                rot.eulerAngles = add.rotate;

                EntityView ev = m_Owner.GetView();
                if (ev != null)
                {
                    return(ev.AddLinkEffect(ref add.strEffectName, ref add.strLinkName, add.vOffset, rot, add.scale, (Engine.LinkFollowType)add.nFollowType, add.bIgnoreRide, add.nLevel, add.callback, add.param));
                }
            }

            return(null);
        }
Пример #6
0
    uint CreateEffect()
    {
        Client.IEntity target = ClientGlobal.Instance().GetEntitySystem().FindNPC(treeEntityID);
        if (target == null)
        {
            Engine.Utility.Log.Error("摇钱树实体查找不到,id为{0}", treeEntityID);
            return(0);
        }
        FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(10001);

        if (edb != null && target != null)
        {
            AddLinkEffect node = new AddLinkEffect();
            node.nFollowType = (int)edb.flowType;
            node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
            node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return(0);
            }
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            if (node.strEffectName.Length != 0)
            {
                int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);

                return((uint)id);
            }
        }

        return(0);
    }
Пример #7
0
    uint CreateEffect(uint nEffectViewID)
    {
        IEntity       target = MainPlayerHelper.GetMainPlayer();
        FxResDataBase edb    = GameTableManager.Instance.GetTableItem <FxResDataBase>(nEffectViewID);

        if (edb != null && target != null)
        {
            if (nEffectViewID == 1002 && EntitySystem.EntityHelper.IsMainPlayer(target))
            {
                //  Engine.Utility.Log.Error("nEffectViewID:{0}", nEffectViewID);
            }

            AddLinkEffect node = new AddLinkEffect();
            node.nFollowType = (int)edb.flowType;
            node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
            node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return(0);
            }
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            if (node.strEffectName.Length != 0)
            {
                int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);

                return((uint)id);
            }
        }

        return(0);
    }
Пример #8
0
        public uint CreateEffect(long lTargetID, uint nEffectViewID)
        {
            IPlayer player = SkillSystem.GetClientGlobal().MainPlayer;

            if (player == null)
            {
                Log.LogGroup("ZDY", "player is null");
                return(0);
            }
            IEntity       target = EntitySystem.EntityHelper.GetEntity(lTargetID);
            FxResDataBase edb    = GameTableManager.Instance.GetTableItem <FxResDataBase>(nEffectViewID);

            if (edb != null && target != null)
            {
                if (nEffectViewID == 1002 && EntitySystem.EntityHelper.IsMainPlayer(target))
                {
                    //  Log.Error("nEffectViewID:{0}", nEffectViewID);
                }
                if (target.GetNode() == null)
                {
                    Log.LogGroup("ZDY", "target getnode is null");
                    return(0);
                }
                Transform enTrans = target.GetTransForm();
                if (enTrans == null)
                {
                    Log.LogGroup("ZDY", "target getnode getransform is null");
                    return(0);
                }
                if (player == null)
                {
                    return(0);
                }

                if (player.GetTransForm() == null)
                {
                    Log.LogGroup("ZDY", "player GetTransForm is null");
                    return(0);
                }

                bool bRide = (bool)target.SendMessage(EntityMessage.EntityCommond_IsRide, null);

                Vector3 tarToPlayer = enTrans.position - player.GetTransForm().position;
                tarToPlayer.y = 0;
                Vector3 cross = Vector3.Cross(tarToPlayer, Vector3.forward);
                float   ang   = Vector3.Angle(tarToPlayer, Vector3.forward);
                if (cross.y < 0)
                {
                    ang = 360 - ang;
                }
                //  Log.Error("旋转角度 " + ang);
                Vector3       rot  = Quaternion.AngleAxis(ang, Vector3.up).eulerAngles;
                AddLinkEffect node = new AddLinkEffect();
                node.nFollowType = (int)edb.flowType;
                node.rotate      = -rot;// new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
                node.vOffset     = bRide ? new Vector3(edb.rideoffset[0], edb.rideoffset[1], edb.rideoffset[2]) : new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

                // 使用资源配置表
                ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
                if (resDB == null)
                {
                    Log.LogGroup("ZDY", "EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                    return(0);
                }
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;
                if (edb.bFollowRole)
                {
                    if (node.strEffectName.Length != 0)
                    {
                        int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);
                        return((uint)id);
                    }
                }
                else
                {
                    int level = 0;
                    if (target != null)
                    {
                        ISkillPart sp = target.GetPart(EntityPart.Skill) as ISkillPart;
                        if (sp != null)
                        {
                            level = sp.FxLevel;
                        }
                    }
                    return(SkillEffectManager.Helper.ReqPlayHitFx(node.strEffectName, target.GetPos(), node.rotate, Vector3.one, level));
                }
            }
            return(0);
        }