Exemplo n.º 1
0
    void Start()
    {
        var sceneName = LevelManagerSingleton.Instance.loadedScene;
        gameProgress = GameProgress.Load ();
        if (sceneName != "level_complete") {   //Check that we are not loading level_complete as a standalone in the editor
            //Upper left panel
            var timeTaken = LevelManagerSingleton.Instance.ElapsedTime ();
            var medalThisTime = gameProgress.GetMedalAttained (sceneName, timeTaken);
            var personalBest = gameProgress.GetLevelBestTime (sceneName);
            var personalBestMedal = gameProgress.GetMedalAttained (sceneName);
            var difference = timeTaken - personalBest;
            var parityString = (difference > 0) ? "+" : "-";
            differenceText.text = "(" + parityString + StopWatch.Format(difference) + ")";
            thisTime.text = StopWatch.Format (timeTaken);
            fastestTime.text = StopWatch.Format (personalBest);
            AssignMedalSprite(fastestTimeImage, personalBestMedal);
            AssignMedalSprite(thisTimeImage, medalThisTime);
            AssignMedalSprite(medalAwarded, personalBestMedal);

            //Upper right panel
            goldTimeText.text = StopWatch.Format(gameProgress.GetGoldMedalTime(sceneName));
            silverTimeText.text = StopWatch.Format(gameProgress.GetSilverMedalTime(sceneName));
            bronzeTimeText.text = StopWatch.Format(gameProgress.GetBronzeMedalTime(sceneName));
        }
    }