public override void OnMessage(byte[] bytes) { //解包读取 var person = DeSerialize <Person>(bytes); GLogger.Log(person.name); ///封包发送 networkMgr.SendData <Person>("Person", person); }
public override void Enter() { base.Enter(); mynpcId = npcFsm.GetVar <long>("mynpcId"); targetId = npcFsm.GetVar <long>("targetId"); myNpcData = npcDataMgr.GetNpcData(mynpcId.value); myNpcData.npcState = NpcState.Attack; GLogger.Log(mynpcId.value + " enter Attack..."); NpcSkillAttack(); }
public override void Enter() { base.Enter(); mynpcId = npcFsm.GetVar <long>("mynpcId"); targetId = npcFsm.GetVar <long>("targetId"); targetId.value = 0; myNpcData = npcDataMgr.GetNpcData(mynpcId.value); myNpcData.npcState = NpcState.Search; GLogger.Log(mynpcId.value + " enter Search..."); }
/// <summary> /// 攻击完成 /// </summary> /// <param name="eventId"></param> private void OnNpcSkillAttackOK(long eventId) { var gameEvent = evMappingMgr.Remove(eventId); if (gameEvent != null) { var attackEvent = gameEvent.evParam as NpcSkillAttackEvent; if (attackEvent != null) { attackEvent.callback(attackEvent.defenderid); } } GLogger.Log("OnNpcSkillAttackOK:" + eventId); }
public override void OnMessage(byte[] bytes) { //解包读取 var person = Person.Parser.ParseFrom(bytes); GLogger.Log(person.Name); ///封包发送 using (MemoryStream stream = new MemoryStream()) { // Save the person to a stream person.WriteTo(stream); bytes = stream.ToArray(); networkMgr.SendData("Person", bytes); } }
/// <summary> /// 动作剪辑播放完成回调函数 /// </summary> /// <param name="obj"></param> private void OnPlayingClipOK(string clip) { switch (clip) { case AnimNames.Attack: //战斗完成 case AnimNames.Skill: OnNpcSkillAttackOK(); PlayRoleAnim(AnimNames.Idle, true); break; case AnimNames.BeAttacked: //被击完成 if (!bRunning) { PlayRoleAnim(AnimNames.Idle, true); } break; } GLogger.Log("OnPlayingClipOK::>>" + gameObject.name + " " + clip); }