public Definitions.SurvivalRank GetRankForLevel(SurvivalLevelData levelData) { Definitions.SurvivalRank rank = Definitions.SurvivalRank.C; if ((levelData.CandyCollectionFraction >= levelData.RankACandyFraction) && (levelData.AttemptsAtLevel < Rank_A_Lives_Used)) { rank = Definitions.SurvivalRank.A; } else if ((levelData.CandyCollectionFraction >= levelData.RankBCandyFraction) && (levelData.AttemptsAtLevel < Rank_B_Lives_Used)) { rank = Definitions.SurvivalRank.B; } return rank; }
public override void Activate() { Profile.SyncPlayerLives(); if (_levelData != null) { ObjectsToSerialize.Remove(_levelData); } _attemptsAtCurrentLevel = NextSceneParameters.Get<int>("attempt-count"); _levelComplete = false; _rankingCoordinator.Reset(); _levelData = new SurvivalLevelData(); _levelData.AttemptsAtLevel = _attemptsAtCurrentLevel; ObjectsToSerialize.Add(_levelData); StatusDisplay.CurrentLevelData = _levelData; StatusDisplay.FreezeDisplayedScore = false; RaceAreaName = ""; base.Activate(); if (Profile.PauseOnSceneActivation) { if (!_rankingCoordinator.LevelCompleted) { if (Profile.CurrentAreaData.Name == "Tutorial") { _tutorialRunner.CheckForStepTrigger(_player.WorldPosition); } if (!_paused) { EnablePause(); } } Profile.PauseOnSceneActivation = false; } if (!RecoveredFromTombstone) { ((PlayerMotionEngine)_player.MotionEngine).DifficultySpeedBoosterUnit = Profile.CurrentAreaData.SpeedStep; _readyPopup.Activate(); } else if (_rankingCoordinator.LevelCompleted) { HandleLevelCleared(); } }