/// <summary> /// ai 오브젝트 풀링하는 함수 /// 1. 초기 딜레이 /// 2. 정해진 수 꺼내줄때까지 계속 /// 3. 넷코드 확인해서 스폰매니저로부터 꺼내게하기 /// 4. 다음스포너 부르기 /// </summary> /// <param name="aiSpawn">스포너 정보</param> /// <param name="idNum">id코드</param> /// <returns></returns> IEnumerator CreateSpawn(SpawnInfo aiSpawn, int idNum) { m_spawnNum = 0; m_spawnCount = 0; // 1. yield return(new WaitForSeconds(aiSpawn.delayTime)); // 2. while (m_spawnCount < aiSpawn.spawnCount) { for (int i = 0; i < AIPoolingManager.instance.aiPools[idNum].max; i++) { // 3. short _netcode = spawnEvent.netcodeDictionary[aiSpawn.prefabID].Dequeue(); AIPoolingManager.instance.SpawnObject(aiSpawn.prefabID, _netcode, transform.position, transform.rotation.y); m_spawnNum++; // 소환 개체 수 만족하면 넘어가기 if (m_spawnNum >= aiSpawn.spawnNum) { m_spawnNum = 0; break; } } m_spawnCount++; yield return(new WaitForSeconds(aiSpawn.spawnTerm)); } // 4. if (++m_spawnArrayNum < spawnEvent.spawnInfo.Length) { // if (spawnEvent.spawnInfo[m_spawnArrayNum].spawnActionTime == SpawnActionTime.SEQUENCE) spawnEvent.spawnPlay(m_spawnArrayNum); } }