private void TickUser(UserInfo user, long delta) { IUserStateLogic logic = AiLogicManager.Instance.GetUserStateLogic(user.GetAiStateInfo().AiLogic); if (null != logic) { logic.Execute(user, m_AiCommandDispatcher, delta); } }
public IUserStateLogic GetUserStateLogic(int id) { IUserStateLogic logic = null; if (m_UserStateLogics.ContainsKey(id)) { logic = m_UserStateLogics[id]; } return(logic); }
public void AlwaysClientTick() { if (0 == m_AlwaysClientLastTickTime) { m_AlwaysClientLastTickTime = TimeUtility.GetServerMilliseconds(); } else { long delta = TimeUtility.GetServerMilliseconds() - m_AlwaysClientLastTickTime; m_AlwaysClientLastTickTime = TimeUtility.GetServerMilliseconds(); if (null != m_NpcMgr) { for (LinkedListNode <NpcInfo> linkNode = m_NpcMgr.Npcs.FirstValue; null != linkNode; linkNode = linkNode.Next) { NpcInfo npc = linkNode.Value; INpcStateLogic logic = AiLogicManager.Instance.GetAlwaysClientNpcStateLogic(npc.GetAiStateInfo().AiLogic); if (null != logic) { logic.Execute(npc, m_AiCommandDispatcher, delta); } } } if (null != m_UserMgr) { for (LinkedListNode <UserInfo> linkNode = m_UserMgr.Users.FirstValue; null != linkNode; linkNode = linkNode.Next) { UserInfo user = linkNode.Value; IUserStateLogic logic = AiLogicManager.Instance.GetAlwaysClientUserStateLogic(user.GetAiStateInfo().AiLogic); if (null != logic) { logic.Execute(user, m_AiCommandDispatcher, delta); } } } } }