using System.Collections; using System.Collections.Generic; using UnityEngine; public class SaveNPCMgr : MonoBehaviourSingletonTemplate { List list_npc = new List(); List list_mob = new List(); List rtn_actors = new List(); bool isSet; protected override void Awake() { base.Awake(); for (int i = 0; i < transform.childCount; i++) { var temp = transform.GetChild(i); var npc = temp.GetComponent(); if (npc != null) list_npc.Add(npc); else { var mob = temp.GetComponent(); mob.m_Role = eRole.QuestMob; list_mob.Add(mob); } } } private void Update() { for (int i = 0; i < list_mob.Count; i++) { if (list_mob[i].Get_Target() != null) { for (int j = 0; j < list_npc.Count; j++) list_npc[j].BubbleOff(); } } } public void Set() { if (list_mob != null) { if (!isSet) { isSet = true; list_mob.ForEach(f => f.Set(true, null, null, 0, false)); } } } public void Set_Clear() { if (list_npc != null) list_npc.ForEach(f => f.Set_Off()); StartCoroutine(Off_Mob()); } IEnumerator Off_Mob() { yield return new WaitForSeconds(1f); if (list_mob != null) list_mob.ForEach(f => f.Off()); } public List Get_QuestMobs() { rtn_actors.Clear(); for (int i = 0; i < list_mob.Count; i++) { var temp = list_mob[i] as Actor; if (!temp.IsDead()) rtn_actors.Add(temp); } return rtn_actors; } public bool IsClearQuestMobs() { for (int i = 0; i < list_mob.Count; i++) { if (!list_mob[i].IsDead()) return false; } return true; } }