| | |
| | | return null; |
| | | } |
| | | |
| | | public GActor GetCloserFightNpc(Vector3 center) |
| | | { |
| | | List<GActor> _list = GetTypeList(E_ActorClassType.NpcFightNorm); |
| | | |
| | | if (_list == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | _list.Sort((GActor a1, GActor a2) => |
| | | { |
| | | float _d1 = MathUtility.DistanceSqrtXZ(center, a1.Pos); |
| | | float _d2 = MathUtility.DistanceSqrtXZ(center, a2.Pos); |
| | | return _d1 < _d2 ? -1 : 1; |
| | | }); |
| | | |
| | | return _list[0]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取离给定坐标最近的NPC对象 |
| | | /// </summary> |
| | | /// <param name="pos"></param> |
| | | /// <param name="npcID"></param> |
| | | /// <returns></returns> |
| | | public GActor GetCloserNPC(Vector3 pos, int npcID) |
| | | public GActor GetCloserNPC(Vector3 pos, int npcID = 0) |
| | | { |
| | | m_AllList.Sort((GActor a1, GActor a2) => |
| | | { |
| | |
| | | if (_npcConfig.NPCType == (int)E_NpcType.Fight) |
| | | { |
| | | GActorNpcFight _fight = m_AllList[i] as GActorNpcFight; |
| | | if (_fight != null) |
| | | if (_fight != null && !_fight.ActorInfo.serverDie) |
| | | { |
| | | if (_fight.NpcConfig.NPCID == npcID) |
| | | if (npcID == 0) |
| | | { |
| | | return _fight; |
| | | } |
| | | else if (_fight.NpcConfig.NPCID == npcID) |
| | | { |
| | | return _fight; |
| | | } |