/// <summary> /// 获得场景中所有npc /// </summary> /// <returns></returns> public static List <MiniMapPointInfo> GetInstanceAllNpc(uint instance_id) { List <MiniMapPointInfo> map_point_infos = new List <MiniMapPointInfo>(); var nep_data = xc.Dungeon.LevelManager.Instance.LoadLevelFileTemporary(SceneHelp.GetFirstStageId(instance_id)); if (nep_data == null) { GameDebug.LogError("get nep_data failed,instance id: " + instance_id); return(map_point_infos); } Dictionary <int, Neptune.BaseGenericNode> monstersData = nep_data.GetData <Neptune.NPC>().Data; foreach (var item in monstersData) { if (item.Value is Neptune.NPC) { Neptune.NPC npc = item.Value as Neptune.NPC; //if (npc.SpawnDirectly) { MiniMapPointInfo info = new MiniMapPointInfo(); info.Id = npc.Id; info.MapId = instance_id; info.ActorId = NpcHelper.GetNpcActorId(npc.ExcelId); info.Name = RoleHelp.GetActorName(info.ActorId); info.BlackName = info.Name; info.Position = npc.Position; info.PointType = MiniMapPointType.Npc; map_point_infos.Add(info); } } } return(map_point_infos); }
public void UpdateExchangeModel() { if (m_need_update_exchange_model == false) { return; } if (m_pkgBossInfo == null) { return; } if (m_pkgBossInfo.state == 1)//世界BOSS处于存活状态,删除墓碑 { if (m_uid != null) { InterObjectManager.Instance.DestroyObject(m_uid); m_uid = null; } m_need_update_exchange_model = false; } else//BOSS已经死亡; BOSS播放完死亡动画=>删除BOSS怪物=>创建墓碑 { // 查询特殊怪物表 var data_mon_attr = DBManager.Instance.GetDB <DBSpecialMon>().GetData(m_pkgBossInfo.id); if (data_mon_attr == null) { GameDebug.LogError("Cannot find special monster info,id:" + m_pkgBossInfo.id); return; } var actor_id = data_mon_attr.ActorId; Dictionary <UnitID, Actor> boss_actor_dict = ActorManager.Instance.GetMonsterSetByActorId(actor_id); bool can_destroy_model = true; foreach (var item in boss_actor_dict) { Actor death_boss_actor = item.Value; if (death_boss_actor != null && death_boss_actor.transform != null) { m_model_Quaternion = death_boss_actor.transform.rotation; Vector3 new_pos = death_boss_actor.transform.position; if (new_pos.y < -500) { GameDebug.LogError(string.Format("boss_actor pos maybe is error new_pos = {0}, {1}, {2}", new_pos.x, new_pos.y, new_pos.z)); } else { m_pos = death_boss_actor.transform.position; } } if (death_boss_actor != null) { AnimationOptions op = death_boss_actor.GetAnimationOptions(Actor.EAnimation.death); if (op != null && can_destroy_model) { if (death_boss_actor.IsPlaying()) { can_destroy_model = false; } } } } if (has_created_inter_object == false) { has_created_inter_object = true; m_monster_name = RoleHelp.GetActorName(actor_id); string prefab = string.Format("Assets/Res/{0}.prefab", RoleHelp.GetPrefabName(actor_id)); InterObject create_inter_object = InterObjectManager.Instance.CreateObject <InterObject>(m_uid, prefab, m_pos, m_model_Quaternion, RoleHelp.GetPrefabScale(actor_id)); if (create_inter_object != null) { create_inter_object.m_StyleInfo.Offset = new Vector3(0, 2.8f, 0); create_inter_object.m_StyleInfo.HeadOffset = new Vector3(0, 2.0f, 0); create_inter_object.m_StyleInfo.ScreenOffset = UI3DText.NameTextScreenOffset; create_inter_object.m_StyleInfo.Scale = Vector3.one; create_inter_object.m_StyleInfo.IsShowBg = false; create_inter_object.m_StyleInfo.SpritName = ""; create_inter_object.IsVisible = false; DBWorldBoss.DBWorldBossItem boss_item = DBManager.Instance.GetDB <DBWorldBoss>().GetData(m_pkgBossInfo.id); if (boss_item != null) { create_inter_object.SetCollider(boss_item.DeathModelCenter, boss_item.DeathModelRadius); } } } if (can_destroy_model) { InterObject create_inter_object = InterObjectManager.Instance.GetObject(m_uid); if (create_inter_object != null) { create_inter_object.IsVisible = true; create_inter_object.SetPosAndQuaternion(m_pos, m_model_Quaternion); } m_need_update_exchange_model = false; } } }