示例#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;
        }
    }
示例#2
0
    private IEnumerator UnlockFirstTime()
    {
        setImage.enabled = true;
        lockedPanel.SetActive(false);

        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);

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