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 RemoveAllLevels() { while (m_activeLevels.First != null) { mg_jr_Level value = m_activeLevels.First.Value; m_activeLevels.RemoveFirst(); if (value != null) { value.DestroyLevel(); } } }
private void RemoveExpiredLevels() { while (m_activeLevels.First != null && m_activeLevels.First.Value.IsSafelyOffLeftOfScreen()) { mg_jr_Level value = m_activeLevels.First.Value; m_activeLevels.RemoveFirst(); if (value != null) { value.DestroyLevel(); } } }
public void RemoveNonVisibleLevels() { while (m_activeLevels.Last != null && !m_activeLevels.Last.Value.IsOnScreen()) { mg_jr_Level value = m_activeLevels.Last.Value; m_activeLevels.RemoveLast(); if (value != null) { value.DestroyLevel(); } } }