public override void CreateEffect(NpcAnimEffect effect) { GameObject obj = null; string src = ""; switch (effect) { case NpcAnimEffect.Skill_1: break; case NpcAnimEffect.Skill_2: src = curMsg.ecd.Middle; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; Destroy(obj, 3f); } break; case NpcAnimEffect.Skill_3: break; default: base.CreateEffect(effect); break; } }
public override void CreateEffect(NpcAnimEffect effect) { GameObject obj = null; string src = ""; switch (effect) { case NpcAnimEffect.Skill_3_Start: src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; obj.transform.parent = cachedTran; Destroy(obj, 4f); } break; case NpcAnimEffect.Trigger: src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; obj.transform.parent = cachedTran; Destroy(obj, 0.4f); } break; default: base.CreateEffect(effect); break; } }
public static GameObject getStatusObj(NpcStatus status) { switch (status) { case NpcStatus.Taunt: if (Effect_ChaoFeng == null) { Effect_ChaoFeng = WarEffectLoader.Load("gongyong/ChaoFeng"); } return(Effect_ChaoFeng); case NpcStatus.Slient: if (Effect_Silence == null) { Effect_Silence = WarEffectLoader.Load("gongyong/Silence"); } return(Effect_Silence); case NpcStatus.Unconscious: if (Effect_Unconscious == null) { Effect_Unconscious = WarEffectLoader.Load("gongyong/Vertigo"); } return(Effect_Unconscious); } return(null); }
// Use this for initialization void Start() { cachedTran = transform; cachedCC = GetComponent <CharacterController>(); fireBall = WarEffectLoader.Load("ServerEffect/ServerFB"); serMgr = WarServerManager.Instance; totHp = cachedNpc.data.rtData.totalHp; curHp = cachedNpc.data.rtData.curHp; }
public virtual void On_Effect(WarMsgParam param) { if (param != null) { string m_str = param.param as string; NpcEffectInfo info = JSON.Instance.ToObject <NpcEffectInfo>(m_str); if (info != null && info.to == cachedNpc.UniqueID) { Effect3DModelConfigData ecd = Core.Data.getIModelConfig <Effect3DModel>().get(info.hitAction); if (ecd != null) { GameObject obj = null; string key = info.from + "_" + ecd.Start; Debug.Log(key, gameObject); if (info.Op == 0) { obj = WarEffectLoader.Load(ecd.Start); if (obj != null) { obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; obj.transform.parent = cachedTran; SkillEffectBase seb = obj.GetComponent <SkillEffectBase>(); ClientNPC srcNpc = cliMgr.npcMgr.GetNpc(info.from); if (seb != null) { seb.EmitEffect(srcNpc, cachedNpc, false); } if (!uiEffectCache.ContainsKey(key)) { uiEffectCache.Add(key, obj); } } else { Debug.Log(string.Format("Fail to load effect obj with name:{0} from:{1} shootAction:{2}", ecd.Start, info.from)); } } else { if (uiEffectCache.TryGetValue(key, out obj)) { uiEffectCache.Remove(key); Destroy(obj); obj = null; } } } } } }
public override void CreateEffect(NpcAnimEffect effect) { GameObject obj = null; string src = ""; switch (effect) { case NpcAnimEffect.Skill_2_Start: { src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); if (obj != null) { skill2_Obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; Destroy(skill2_Obj, curMsg.animationTimer); } } } break; case NpcAnimEffect.Skill_3_Start: { Debug.Log(fastJSON.JSON.Instance.ToJSON(curMsg)); src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); if (obj != null) { List <Vec3F> pos = curMsg.objCrtV; if (pos != null) { Vector3 p = pos[0].toUnityVec3(); obj = Instantiate(obj, p, Quaternion.identity) as GameObject; Destroy(obj, 3f); } } } } break; default: base.CreateEffect(effect); break; } }
public virtual void CreateEffect(NpcAnimEffect effect) { GameObject obj = null; string src = ""; switch (effect) { case NpcAnimEffect.Attack_1_Start: case NpcAnimEffect.Attack_2_Start: case NpcAnimEffect.Attack_3_Start: src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && !(src == "[]")) { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; Destroy(obj, 2f); } break; case NpcAnimEffect.Attack_1: case NpcAnimEffect.Attack_2: case NpcAnimEffect.Attack_3: src = curMsg.ecd.Middle; if (!string.IsNullOrEmpty(src) && !(src == "[]")) { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, attackPoint.position, cachedTran.rotation) as GameObject; ClientFB fb = obj.GetComponent <ClientFB>(); if (fb != null) { fb.Init(curMsg); } else { Destroy(obj, 2f); } } break; case NpcAnimEffect.Skill_1: break; case NpcAnimEffect.Skill_1_Start: src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; Destroy(obj, 5f); } break; case NpcAnimEffect.Skill_2: break; case NpcAnimEffect.Skill_2_Start: src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; Destroy(obj, 5f); } break; case NpcAnimEffect.Skill_3: break; case NpcAnimEffect.Skill_3_Start: src = curMsg.ecd.Start; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; Destroy(obj, 5f); } break; case NpcAnimEffect.Skill_4: break; case NpcAnimEffect.Skill_4_Start: break; } }
// Use this for initialization public override void Start() { base.Start(); child = WarEffectLoader.Load("1003/1003_chuxian"); }
public void InitSk(ServerNPC npc, WarMsgParam msg) { base.castor = npc; base.param = msg; bulletNpc = WarEffectLoader.Load("ServerEffect/ServerBulletNpc"); }
public override void CreateEffect(NpcAnimEffect effect) { GameObject obj = null; string src = ""; switch (effect) { case NpcAnimEffect.Skill_1: src = curMsg.ecd.Middle; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); if (obj != null) { obj = Instantiate(obj, attackPoint.position, cachedTran.rotation) as GameObject; SkillEffectBase seb = obj.GetComponent <SkillEffectBase>(); if (seb != null) { seb.LifeTime(1f); seb.EmitEffect(null, null, false); } else { Destroy(seb, 1f); } } } break; case NpcAnimEffect.Skill_2: src = curMsg.ecd.Middle; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); if (obj != null) { Vector3 pos = Vector3.zero; ClientNPC npc = cliMgr.npcMgr.GetNpc(curMsg.targetId); if (npc != null) { pos = npc.CachedTran.position; } else { pos = cachedTran.position + cachedTran.rotation * Vector3.forward * 5f; } obj = Instantiate(obj, pos, cachedTran.rotation) as GameObject; Destroy(obj, 3f); } } break; case NpcAnimEffect.Skill_3: src = curMsg.ecd.Middle; if (!string.IsNullOrEmpty(src) && src != "[]") { obj = WarEffectLoader.Load(src); if (obj != null) { obj = Instantiate(obj, cachedTran.position, cachedTran.rotation) as GameObject; if (obj != null) { ClientNPC npc = cliMgr.npcMgr.GetNpc(curMsg.targetId); SkillEffectBase seb = obj.GetComponent <SkillEffectBase>(); if (npc != null && seb != null) { Vector3 dir = npc.transform.position; dir.y = cachedTran.position.y; dir = dir - cachedTran.position; Quaternion rot = Quaternion.LookRotation(dir, Vector3.up); obj.transform.rotation = rot; seb.EmitEffect(cachedNpc, npc, false); } Destroy(obj, 0.2f); } } } break; default: base.CreateEffect(effect); break; } }