Пример #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));
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1; //In case we arrived here from a paused state
        _gameProgress = GameProgress.Load ();

        selectText1.text = _gameProgress.GetLevelName ("level_" + world + "_1");
        selectText2.text = _gameProgress.GetLevelName ("level_" + world + "_2");
        selectText3.text = _gameProgress.GetLevelName ("level_" + world + "_3");
        selectText4.text = _gameProgress.GetLevelName ("level_" + world + "_4");
        selectText5.text = _gameProgress.GetLevelName ("level_" + world + "_5");
        selectText6.text = _gameProgress.GetLevelName ("level_" + world + "_6");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_7");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_8");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_9");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_10");

        AssignMedalSprite (selectMedal1, _gameProgress.GetMedalAttained ("level_" + world + "_1"));
        AssignMedalSprite (selectMedal2, _gameProgress.GetMedalAttained ("level_" + world + "_2"));
        AssignMedalSprite (selectMedal3, _gameProgress.GetMedalAttained ("level_" + world + "_3"));
        AssignMedalSprite (selectMedal4, _gameProgress.GetMedalAttained ("level_" + world + "_4"));
        AssignMedalSprite (selectMedal5, _gameProgress.GetMedalAttained ("level_" + world + "_5"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_6"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_7"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_8"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_9"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_10"));

        padlock1.enabled = false;

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_1")) {
            selectText2.text = "";
            selectMedal2.enabled = false;
            var navigation = level1Button.navigation;
            navigation.selectOnRight = null;
            level1Button.navigation = navigation;
            level2Button.interactable = false;
            padlock2.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_2")) {
            selectText3.text = "";
            selectMedal3.enabled = false;
            var navigation = level2Button.navigation;
            navigation.selectOnRight = null;
            level2Button.navigation = navigation;
            level3Button.interactable = false;
            padlock3.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_3")) {
            selectText4.text = "";
            selectMedal4.enabled = false;
            var navigation = level3Button.navigation;
            navigation.selectOnRight = null;
            level3Button.navigation = navigation;
            level4Button.interactable = false;
            padlock4.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_4")) {
            selectText5.text = "";
            selectMedal5.enabled = false;
            var navigation = level4Button.navigation;
            navigation.selectOnDown = null;
            level4Button.navigation = navigation;
            level5Button.interactable = false;
            padlock5.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_5")) {
            selectText6.text = "";
            selectMedal6.enabled = false;
            var navigation = level5Button.navigation;
            navigation.selectOnLeft = null;
            level5Button.navigation = navigation;
            level6Button.interactable = false;
            padlock6.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_6")) {
            selectText7.text = "";
            selectMedal7.enabled = false;
            var navigation = level6Button.navigation;
            navigation.selectOnLeft = null;
            level6Button.navigation = navigation;
            level7Button.interactable = false;
            padlock7.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_7")) {
            selectText8.text = "";
            selectMedal8.enabled = false;
            var navigation = level7Button.navigation;
            navigation.selectOnLeft = null;
            level7Button.navigation = navigation;
            level8Button.interactable = false;
            padlock8.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_8")) {
            selectText9.text = "";
            selectMedal9.enabled = false;
            var navigation = level8Button.navigation;
            navigation.selectOnLeft = null;
            level8Button.navigation = navigation;
            level9Button.interactable = false;
            padlock9.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_9")) {
            selectText10.text = "";
            selectMedal10.enabled = false;
            var navigation = level9Button.navigation;
            navigation.selectOnLeft = null;
            level9Button.navigation = navigation;
            level10Button.interactable = false;
            padlock10.enabled = true;
        }
    }