Example #1
0
 public void UpdateTarget(NpcInfo npc)
 {
     if (npc.GetAIEnable())
     {
         NpcAiStateInfo npcAi   = npc.GetAiStateInfo();
         long           curTime = TimeUtility.GetServerMilliseconds();
         if (npcAi.Target > 0)
         {
             if (curTime > npcAi.LastChangeTargetTime + m_ChangeTargetCD && curTime > npc.GetCombatStatisticInfo().LastHitTime + m_MaxChaseTime)
             {
                 npcAi.Target = 0;
                 NotifyNpcTargetChange(npc);
                 npcAi.LastChangeTargetTime = curTime;
                 LogSystem.Debug("Npc {0} changed target", npc.GetId());
             }
         }
     }
 }