private void TickNpcs() { List <NpcInfo> deletes = new List <NpcInfo>(); for (LinkedListNode <NpcInfo> linkNode = m_NpcMgr.Npcs.FirstValue; null != linkNode; linkNode = linkNode.Next) { NpcInfo info = linkNode.Value; if (info.LevelChanged || info.GetShootStateInfo().WeaponChanged || info.GetSkillStateInfo().BuffChanged || info.GetEquipmentStateInfo().EquipmentChanged) { NpcAttrCalculator.Calc(info); info.LevelChanged = false; info.GetShootStateInfo().WeaponChanged = false; info.GetSkillStateInfo().BuffChanged = false; info.GetEquipmentStateInfo().EquipmentChanged = false; } // 约定npc的高度低于140时,直接判定npc死亡。 if (140.0f > info.GetMovementStateInfo().GetPosition3D().Y) { info.SetHp(Operate_Type.OT_Absolute, 0); } if (info.NeedDelete) { deletes.Add(info); } else if (info.Hp <= 0) { if (!info.LogicDead) { GfxSystem.PublishGfxEvent("ge_on_npc_dead", "story", info.GetUnitId()); info.LogicDead = true; } if (info.DeadTime <= 0) { } else if (TimeUtility.GetServerMilliseconds() - info.DeadTime > info.ReleaseTime) { deletes.Add(info); } } if (info.IsBorning && IsNpcBornOver(info)) { info.IsBorning = false; info.SetAIEnable(true); info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible); } } if (deletes.Count > 0) { foreach (NpcInfo ni in deletes) { CharacterView view = EntityManager.Instance.GetCharacterViewById(ni.GetId()); if (null != view) { GfxSystem.SendMessage(view.Actor, "OnDead", null); } EntityManager.Instance.DestroyNpcView(ni.GetId()); WorldSystem.Instance.DestroyCharacterById(ni.GetId()); return; } } }