public void AddLevelsToQueue(EnvironmentType _type, float _maxTotalWidth) { Assert.AreNotEqual(EnvironmentType.MAX, _type, "Not a valid environemnt"); DifficultyRange difficultyRange = m_availableDifficulties[_type]; float num = 0f; foreach (mg_jr_Level activeLevel in m_activeLevels) { num += activeLevel.LevelDefinition.Size.x; } int num2 = 0; while (num <= _maxTotalWidth) { mg_jr_Level current = AddRandomLevelToQueue(_type, difficultyRange.RandomDifficulty()); num += current.LevelDefinition.Size.x; num2++; } mg_jr_Level value = m_activeLevels.Last.Value; m_activeLevels.RemoveLast(); if (value != null) { value.DestroyLevel(); } num2--; Debug.Log("_maxTotalWidth" + _maxTotalWidth); Debug.Log("loaded turbo levels =" + num2); }
public void AddXtoQueue(EnvironmentType _type, int _numberOfLevelsToAdd) { Assert.AreNotEqual(EnvironmentType.MAX, _type, "Not a valid environemnt"); DifficultyRange difficultyRange = m_availableDifficulties[_type]; for (int i = 0; i <= _numberOfLevelsToAdd; i++) { AddRandomLevelToQueue(_type, difficultyRange.RandomDifficulty()); } }
public void FillQueueWith(EnvironmentType _type, int _numberOfLevelsToFillQueueTo) { Assert.AreNotEqual(EnvironmentType.MAX, _type, "Not a valid environemnt"); if (m_activeLevels.Count >= _numberOfLevelsToFillQueueTo) { DisneyMobile.CoreUnitySystems.Logger.LogWarning(this, "Can't fill queue with level type because queue is full"); return; } DifficultyRange difficultyRange = m_availableDifficulties[_type]; while (m_activeLevels.Count < _numberOfLevelsToFillQueueTo) { AddRandomLevelToQueue(_type, difficultyRange.RandomDifficulty()); } }