public LevelManager(List<Level> levels) { this.mLevels = levels; this.mCurrLevel = levels[0]; }
protected IEnumerator LevelLoadAsync(Level level,LoadingAction loadingAction) { bool found = false; mProgress = 0; Loading = false; if (mLevels.Contains(level)) found = true; if (found) { mAsync = Application.LoadLevelAsync(mCurrLevel.mLevelName); while (!mAsync.isDone) { Loading = true; mCurrLevel.mState = LevelState.LOADING; mProgress = mAsync.progress; loadingAction(mProgress, Loading); yield return null; } Loading = false; mCurrLevel.mState = LevelState.START; } else { Debug.LogError("Level doesn't exist"); yield break; } }