public NpcActorModule(BaseNpc Master) : base(Master) { Animation_ = new NpcAnimation(Master.GetComponent <Animator>()); Fsm_ = new BaseFsm(Master); Direction = NpcDirection.Right; }
public override void EnterState() { Debug.Log("Player is Moving"); rigid = aiAttribute.GetComponent <Rigidbody2D>(); speed = aiAttribute.GetPlayerData().Speed; npcAnim = aiAttribute.GetComponent <NpcAnimation>(); }
//发送Npc动作信息 public void SendNpcAnimation(UInt16 npcAnimationType, int npcId, UInt16 stationIndex, UInt16 stationClientType) { if (m_stationModule == null || m_networkModule == null) { return; } List <PlayerActor> u3dPlayerActorList = null; m_stationModule.GetU3DPlayerActors(stationIndex, ref u3dPlayerActorList); if (u3dPlayerActorList == null || u3dPlayerActorList.Count == 0) { return; } PlayerActor stationPlayerActor = null; for (int k = 0; k < u3dPlayerActorList.Count; k++) { stationPlayerActor = m_networkModule.GetStationPlayerActorAboutU3DPlayerActor(u3dPlayerActorList[k], stationIndex, stationClientType); if (stationPlayerActor != null) { Agent agent = stationPlayerActor.Agent; NpcAnimation npcAnimation = new NpcAnimation() { m_npcAnimationType = npcAnimationType, m_npcId = npcId, m_stationIndex = stationIndex, m_stationClientType = stationClientType, }; byte[] bytes = npcAnimation.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 0; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.NpcAnimationMessageID, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } }
void Awake() { aiAttribute = GetComponent <AIAttribute>(); npcAnim = GetComponent <NpcAnimation>(); }