Example #1
0
    public void ShowLevel(int level, RectTransform parent, LevelTier tier)
    {
        GameController game = FindObjectOfType<GameController>();
        LevelTemplate levelTemplate = FindObjectOfType<LevelTemplate>();

        if (Application.loadedLevel == level)
        {
            current.enabled = true;
        }
        else if (game.IsLevelUnlocked(level))
        {
            completed.enabled = true;
            int levelTime = game.GetCompletedLevelScore(level);
            Score.text = levelTemplate.GetScoreForTime(tier, levelTime);
        }
        else
        {
            locked.enabled = true;
        }

        GetComponent<RectTransform>().SetParent(parent);
        Title.text = tier.Title;
    }
Example #2
0
    public string GetScoreForTime(LevelTier tier, float time)
    {
        if (time < tier.TierA)
        {
            return "A";
        }

        if (time < tier.TierB)
        {
            return "B";
        }

        if (time < tier.TierC)
        {
            return "C";
        }

        if (time < tier.TierD)
        {
            return "D";
        }

        return "E";
    }