Exemple #1
0
        private void TickUser(UserInfo user, long delta)
        {
            IUserStateLogic logic = AiLogicManager.Instance.GetUserStateLogic(user.GetAiStateInfo().AiLogic);

            if (null != logic)
            {
                logic.Execute(user, m_AiCommandDispatcher, delta);
            }
        }
Exemple #2
0
        public IUserStateLogic GetUserStateLogic(int id)
        {
            IUserStateLogic logic = null;

            if (m_UserStateLogics.ContainsKey(id))
            {
                logic = m_UserStateLogics[id];
            }
            return(logic);
        }
Exemple #3
0
 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);
                 }
             }
         }
     }
 }