Пример #1
0
        private void TickNpc(NpcInfo npc, long delta)
        {
            INpcStateLogic logic = AiLogicManager.Instance.GetNpcStateLogic(npc.GetAiStateInfo().AiLogic);

            if (null != logic)
            {
                logic.Execute(npc, m_AiCommandDispatcher, delta);
            }
        }
Пример #2
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);
                 }
             }
         }
     }
 }