Exemple #1
0
    private void SetUnlocked()
    {
        setImage.enabled = true;
        lockedPanel.SetActive(false);
        setBG.sprite = setBGDefault;

        float mapSize = GameObject.FindObjectOfType <LevelMapScript> ().size;

        for (int i = 0; i < set.levelAmount; i++)
        {
            GameObject go = Instantiate(buttonPrefab) as GameObject;
            go.transform.SetParent(transform);
            LevelButtonHandler handler = go.GetComponent <LevelButtonHandler>();
            handler.Init(i, set);

            handler.SetPosition(CalculateButtonPosition(i, mapSize));
        }
        if (set.setImage == null)
        {
            setImage.enabled = false;
        }
        else
        {
            setImage.sprite = set.setImage;
        }

        if (set.checkCompletion() && !set.completed)
        {
            setChest.enabled = true;
        }
    }
Exemple #2
0
    private LevelSet set; //The kind of set the group has

    void Awake()
    {
        flashOfWhite = GameObject.Find("flashOfWhite");
        RectTransform rect = GetComponent <RectTransform>();

        //rect.anchoredPosition *= GameObject.FindObjectOfType<LevelMapScript>().size;

        set = LevelHandler.GetLevelSet(setName);
        if (set.checkCompletion() && !set.completed)
        {
            setChest.enabled = true;
        }

        int playerStars = PlayerPrefs.GetInt(SaveStrings.sPlayerStars);

        if (playerStars >= set.neededStars && set.unlocked == true && set.animated == true && set.completed == true)
        {
            SetCompleted();
        }
        else if (playerStars >= set.neededStars && set.unlocked == true && set.animated == true)
        {
            SetUnlocked();
        }
        else
        {
            SetLocked(playerStars);
        }
    }