void CheckLevel(LevelBase level) { bool allCriteraMet = true; UnlockCriteria[] mUnlockCriterias = level.GetComponents<UnlockCriteria>(); for (int j = 0; j < mUnlockCriterias.Length; j++) { UnlockCriteria mUnlockCriteria = mUnlockCriterias[j]; if (!mUnlockCriteria.CriteriaMet()) { allCriteraMet = false; } } if (allCriteraMet) { level.UnlockLevel(); } else { level.LockLevel(); } }