/// <summary> /// Constructor /// </summary> /// <param name="topLevel"></param> /// <param name="completedLevel"></param> /// <param name="simulation"></param> public CompletionScreen(TopLevelModel topLevel, LevelScoreData completedLevel, Simulation simulation) : base(topLevel) { levelData = completedLevel; this.simulation = simulation; base.TransitionOnTime = TimeSpan.FromSeconds(0.5); base.TransitionOffTime = TimeSpan.FromSeconds(0.5); }
/// <summary> /// Called when the level is completed. /// </summary> /// <param name="clearData">A struct containing information about the user's performance.</param> void OnLevelCompletion(LevelScoreData clearData) { ScreenList.AddScreen(new CompletionScreen(TopLevel, clearData, simulation)); }
/// <summary> /// Creates a LevelScoreData structure containing information about the /// user's performance on a level. /// </summary> /// <returns>Information about the user's score.</returns> private LevelScoreData CreateScoreData() { LevelScoreData clearData = new LevelScoreData(); clearData.LevelName = _name; clearData.TreasuresCollected = _collectedTreasures; clearData.TreasuresInLevel = _treasures.Count; clearData.BallsLeft = _attemptsLeft; clearData.TimeSpent = (int)_elapsedTime; // Cut off the fractional part clearData.ParTime = _parTime; // 500 per treasure, 150 per ball left, 100 for beating the par time, 42 for level completion int treasureScore = 500 * _collectedTreasures; int ballsLeftScore = 150 * _attemptsLeft; int parTimeScore = clearData.TimeSpent <= clearData.ParTime ? 100 : 0; clearData.Score = treasureScore + ballsLeftScore + parTimeScore + 42; return clearData; }