Beispiel #1
0
    private IEnumerator Init()
    {
        LevelSetHandler set    = GetComponent <LevelSetHandler>();
        bool            passed = Level.Load(set.setName, 0).star1;
        //Debug.Log(set.setName + " " + passed);
        bool showFinger = set.Unlocked && !passed;

        if (showFinger == true && !set.Set.animated)
        {
            yield return(new WaitForSeconds(2.5f));

            finger.SetActive(showFinger);
        }
        else
        {
            finger.SetActive(showFinger);
        }
    }
Beispiel #2
0
    void Awake()
    {
        pathInterval = 50;  //Need to be replaced to adjust for different screen sizes

        float mapSize = GameObject.FindObjectOfType <LevelMapScript>().size;
        //Calculate the panels width and height.
        Vector2 screen = (new Vector2(Screen.width, Screen.height) * mapSize);

        startPointRadius = startPoint.sizeDelta.x;
        if (startPoint.sizeDelta.y < startPointRadius)
        {
            startPointRadius = startPoint.sizeDelta.y;
        }
        startPointRadius *= .5f;

        endPointRadius = endPoint.sizeDelta.x;
        if (endPoint.sizeDelta.y < endPointRadius)
        {
            endPointRadius = endPoint.sizeDelta.y;
        }
        endPointRadius *= .5f;

        startPosition = startPoint.anchoredPosition;

        endPosition = endPoint.anchoredPosition;

        direction      = (endPosition - startPosition).normalized;
        startPosition += direction * (startPointRadius + pathInterval);
        endPosition   -= direction * (endPointRadius + pathInterval);

        distance = Vector3.Distance(startPosition, endPosition);
        amount   = distance / pathInterval;

        LevelSetHandler set = endPoint.GetComponent <LevelSetHandler>();

        if (set.Unlocked && set.Set.animated)
        {
            SetUnlocked();
        }
        else if (set.Unlocked)
        {
            StartCoroutine(SetUnlockedAnimated(set));
        }
    }
Beispiel #3
0
    private IEnumerator SetUnlockedAnimated(LevelSetHandler set)
    {
        yield return(new WaitForSeconds(1));

        float speed = 6;
        float time  = (1 / speed) * amount;

        StartCoroutine(GameObject.FindObjectOfType <LevelMapScript>().MoveToNextSet(startPoint, endPoint, time));

        for (int i = 0; i < amount; i++)
        {
            GameObject    go = Instantiate(pathBallPrefab) as GameObject;
            RectTransform r  = go.transform as RectTransform;
            r.SetParent(transform);
            r.localScale = Vector3.one;

            Vector3 pos = startPosition + direction * pathInterval * i;
            r.anchoredPosition = pos;

            yield return(StartCoroutine(AnimateAlpha(go.GetComponent <Image>(), speed)));
        }
        set.OpenSetFirstTime();
    }
    //void Update () {
    //	if (trigger) {
    //		complete ();
    //		trigger = false;
    //	}
    //}

    public bool setLevelSet(GameObject levelS)
    {
        levelSet = levelS;
        handler  = levelSet.GetComponent <LevelSetHandler>();
        return(levelSet != null ? true : false);
    }