public void UpdateStarCount()
{
_mStarCount = 0;
foreach (var level in _mLevels)
_mStarCount += level.StarCount();
if (!TrialMode || _mLatestUnlocked < 1)
{
if (!_mHasBeatFinal && _mStarCount > 480)
{
_mHasBeatFinal = true;
_mShowCongrats = true;
}
if (_mStarCount < 30)
{
if (_loaded == false)
_loaded = true;
UnlockWorld(0);
return;
}
if (!_loaded)
{
_mLatestUnlocked = Math.Max(_mLatestUnlocked, Math.Min(_mStarCount / 30, 7));
if (!TrialMode || _mLatestUnlocked < 1)
UnlockWorld(_mLatestUnlocked);
_loaded = true;
}
else if (_mLatestUnlocked < 7)
{
if (_loaded && _mLatestUnlocked < _mStarCount / 30 && (_mLatestUnlocked = Math.Max(_mLatestUnlocked, Math.Min(_mStarCount / 30, 7))) < NumOfWorlds - 1)
{
_mWorldUnlocked = true;
UnlockWorld(_mLatestUnlocked);
if (_mLatestUnlocked == 8)
return;
}
}
else if (_mStarCount >= 480 && _mLatestUnlocked < NumOfWorlds - 1)
{
_mWorldUnlocked = true;
_mLatestUnlocked = NumOfWorlds - 1;
UnlockWorld(_mLatestUnlocked);
}
}
}