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); }
/// <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); } } }
void AddNpcTip(Client.IEntity entity, uint effectId, uint nTaskId, GameCmd.TaskProcess process) { NpcTips tips; if (m_DictNpceffect.TryGetValue(entity.GetID(), out tips)) { if (tips.process == process) { return; } } table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(effectId); if (edb != null) { Client.AddLinkEffect node = new Client.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 UnityEngine.Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]); node.vOffset = new UnityEngine.Vector3(edb.offset[0], edb.offset[1], edb.offset[2]); node.strEffectName = resDB.strPath; node.strLinkName = edb.attachNode; if (node.strEffectName.Length != 0) { int eId = (int)entity.SendMessage(Client.EntityMessage.EntityCommand_AddLinkEffect, node); if (m_DictNpceffect.ContainsKey(entity.GetID())) { entity.SendMessage(Client.EntityMessage.EntityCommand_RemoveLinkEffect, m_DictNpceffect[entity.GetID()].effectid); m_DictNpceffect[entity.GetID()].effectid = eId; m_DictNpceffect[entity.GetID()].process = process; } else { m_DictNpceffect.Add(entity.GetID(), new NpcTips() { effectid = eId, npcid = entity.GetID(), taskid = nTaskId, process = process }); } } } }