public void Init(ServerNPC parent, WarMsgParam param) { owner = parent; wmMgr = WarServerManager.Instance; tran = transform; if (param is WarSrcAnimParam) { WarSrcAnimParam wp = param as WarSrcAnimParam; sphereParam = wp; WarTarAnimParam[] tars = wp.InjureTar; speed = wp.described.targetEnd.param8; maxDis = wp.described.targetEnd.param9; if (tars != null && tars.Length > 0) { SelfDescribed sd = tars[0].described; npcId = sd.targetEnd.param5; if (wmMgr != null) { target = wmMgr.npcMgr.GetNPCByUniqueID(npcId); if (target != null && parent.outLog) { Debug.Log("Sphere target : " + target.name); } } } else { target = null; } } inited = true; }
public void CastSk(params Object[] args) { if (castor != null && param != null) { WarSrcAnimParam srcParam = param as WarSrcAnimParam; if (srcParam != null) { SelfDescribed sd = srcParam.described; if (sd != null) { EndResult result = sd.targetEnd; if (result != null) { WarServerManager mgr = WarServerManager.Instance; int target = result.param3; ServerNPC npc = mgr.npcMgr.GetNPCByUniqueID(target); if (npc != null) { Vector3 dir = npc.transform.position; dir.y = castor.transform.position.y; dir = dir - castor.transform.position; Quaternion rot = Quaternion.LookRotation(dir, Vector3.up); castor.transform.rotation = rot; LeanTween.cancel(castor.gameObject); LeanTween.move(castor.gameObject, npc.transform.position, 0.2f); castor.SendNpcMoveMsg(true); } } } } } }
public void IfEnd (RtBufData buf, Trigger trigger) { var info = trigger.GetType(); var classAttribute = (TriggerAttribute)Attribute.GetCustomAttribute(info, typeof(TriggerAttribute)); WarServerManager warMgr = WarServerManager.Instance; warMgr.bufMgr.rmBuff(buf.ID, buf.HangUpNpcID); warMgr.triMgr.RemoveTrigger(classAttribute.Cmd, trigger.TriggerId, trigger.HangUpNpcId); }
public ServerCreator(WarServerManager server) { WarSMgr = server; AiLoader = Core.ResEng.getLoader <AILoader>(); virNpcLoader = Core.ResEng.getLoader <VirtualNpcLoader>(); reader = Core.Data.getIModelConfig <SceneEditorDataRead>(); }
// 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 override void Init(ServerNPC owner, WarMsgParam param) { parent = owner; ConsoleEx.DebugLog(parent.name); wmMgr = WarServerManager.Instance; UniqueId = wmMgr.npcMgr.SignID(this); Camp = Camp.set(owner.Camp); WarSrcAnimParam wp = param as WarSrcAnimParam; if (wp != null) { SelfDescribed sd = wp.described; EndResult result = sd.srcEnd; lifeTime = result.param8; } inited = true; }
void SendCrtBulletMsg(ServerNPC npc) { IpcCreateNpcMsg msg = new IpcCreateNpcMsg(); msg.npclist = new CrtHero[1]; msg.npclist[0] = new CrtHero(); msg.npclist[0].npcID = npc.data.configData.ID; msg.npclist[0].uniqueId = npc.UniqueID; msg.npclist[0].camp = (int)npc.Camp; msg.npclist[0].pos = VectorWrap.ToVector(npc.transform.position); msg.npclist[0].rotation = VectorWrap.ToVector(npc.transform.eulerAngles); WarServerManager mgr = WarServerManager.Instance; if (mgr != null) { mgr.realServer.proxyCli.CtorNpc(msg); } }
public override void Awake() { base.Awake(); warServerMgr = WarServerManager.Instance; npcMgr = warServerMgr.npcMgr; chaPool = warServerMgr.realServer.monitor.CharactorPool; animMsg = new IpcNpcAnimMsg(); hpMsg = new IpcNpcHpMsg(); skMsg = new IpcSkillMsg(); animState = gameObject.AddComponent <ServerNpcAnimState>(); if (animState != null) { broadcast = animState.OnNewStateReceived; animState.cachedNpc = this; } }
public void CastSk(params Object[] args) { if (castor != null && param != null) { WarSrcAnimParam srcParam = param as WarSrcAnimParam; if (srcParam != null) { SelfDescribed sd = srcParam.described; if (sd != null) { EndResult result = sd.srcEnd; // float x = result.param8; // float z = result.param9; Vector3 pos = Vector3.zero; // castor.transform.position = pos; // castor.SendNpcMoveMsg(true); if (castor is ServerLifeNpc) { ServerLifeNpc sCastor = castor as ServerLifeNpc; sCastor.HitAnimReset(); } int clearFlag = result.param1; if (clearFlag == 0) { ServerNPC npc = castor.getOneChildNpc(result.param2); if (npc != null) { pos = npc.transform.position; pos.y = 0.1f; castor.transform.position = pos; castor.SendNpcMoveMsg(true); castor.removeChild(npc); WarServerManager mgr = WarServerManager.Instance; IpcDestroyNpcMsg msg = new IpcDestroyNpcMsg(); msg.id = npc.UniqueID; mgr.realServer.proxyCli.NpcDestroy(msg); UnityEngine.GameObject.Destroy(npc.gameObject); } } } } } }
public void MoveStop(string MoveStopInfo) { AsyncTask.QueueOnMainThread( () => { WarServerManager mgr = WarServerManager.Instance; if (mgr != null) { NpcAnimInfo info = JSON.Instance.ToObject <NpcAnimInfo>(MoveStopInfo); ServerLifeNpc npc = monitor.CharactorPool.findActionNpc(info.ui); WarSrcAnimParam param = new WarSrcAnimParam(); param.cmdType = WarMsg_Type.Stand; param.param = MoveStopInfo; mgr.npcMgr.SendMessageAsync(npc.UniqueID, npc.UniqueID, param); } } ); processedMsg = new NetMQMessage(); processedMsg.Append(WarMsgConsts.MoveStopRep); }
public void Attack(string AttackInfo) { AsyncTask.QueueOnMainThread( () => { WarServerManager mgr = WarServerManager.Instance; if (mgr != null) { NpcAnimInfo info = JSON.Instance.ToObject <NpcAnimInfo>(AttackInfo); ServerLifeNpc npc = monitor.CharactorPool.findActionNpc(info.ui); if (npc != null) { npc.Attack(); } } } ); processedMsg = new NetMQMessage(); processedMsg.Append(WarMsgConsts.AttackRep); }
void Awake() { Instance = this; npcMgr = new ServerNpcMgrFactory().getNpcMgr(); npcMgr.Init(); creator = new ServerCreator(this); sufMgr = EffectSufferMgr.instance; npcSkill = SkillCastor.Instance; npcSkill.init(npcMgr); triMgr = TriggerMgr.Instance; triMgr.Init(npcMgr); bufMgr = BuffMgr.Instance; bufMgr.init(npcMgr, triMgr); StartCoroutine(checkClientUIReady()); }
public void CastSk(params Object[] args) { if (castor != null && param != null) { WarSrcAnimParam srcParam = param as WarSrcAnimParam; if (srcParam != null) { WarTarAnimParam[] targets = srcParam.InjureTar; if (targets != null && targets.Length > 0) { WarServerManager mgr = WarServerManager.Instance; for (int i = 0; i < targets.Length; i++) { if (targets[i] != null) { mgr.npcMgr.SendMessageAsync(castor.UniqueID, targets[i].described.target, targets[i]); } } } } } }
/// <summary> /// Init the specified owner and param. /// </summary> /// <param name="owner">Owner.</param> /// <param name="param">Parameter.</param> public override void Init(ServerNPC owner, WarMsgParam param) { parent = owner; tran = transform; wmMgr = WarServerManager.Instance; Camp = Camp.set(parent.Camp); WarSrcAnimParam srcParam = param as WarSrcAnimParam; if (srcParam != null) { SelfDescribed sd = srcParam.described; if (sd != null) { EndResult result = sd.targetEnd; int effectIndex = result.param2; targetIndex = result.param5; if (targetIndex > 0) { if (wmMgr != null) { target = wmMgr.npcMgr.GetNPCByUniqueID(targetIndex); } } EffectConfigData effect = Core.Data.getIModelConfig <EffectModel>().get(effectIndex); if (effect != null) { effectID = effectIndex; speed = effect.Param3 / 1000f; maxDis = effect.Param4 / 1000; damageType = effect.Param8; disappearType = effect.Param5; } // string msg = string.Format("[effect:{0} speed:{1} maxDis:{2} disappearType:{3} damageType:{4}]", effectID, speed, maxDis, disappearType, damageType); // Debug.Log(msg); } inited = true; } }