public IEnumerator OnLoadLevel(System.Action <float> OnProgressAction) { if (m_rootNodeGroup != null) { int childCount = m_rootNodeGroup.GetNumChildren(); if (childCount <= 0) { yield return(new WaitForEndOfFrame()); if (OnProgressAction != null) { OnProgressAction(1.0f); } yield break; } float baseProgress = 0.0f; float loadingProgressRate = 1.0f / childCount; for (int i = 0; i < childCount; ++i) { LevelBase level = m_rootNodeGroup.GetChild(i) as LevelBase; if (level != null) { yield return(level.OnLoadLevel((progress) => { OnProgressAction(baseProgress + (progress * loadingProgressRate)); })); baseProgress += loadingProgressRate; } } } yield return(new WaitForEndOfFrame()); if (OnProgressAction != null) { OnProgressAction(1.0f); } }