Exemplo n.º 1
0
    void Start()
    {
        SeasonText.text = "Winter";
        //isSummer = ArcticController.Instance.visits % 2 == 0;
        isSummer = false;
        var srs = GetComponentsInChildren <SpriteRenderer>();

        (summerSR, winterSR) = (srs[0], srs[1]);

        // init fade funcs
        fadeIn  = (float step, float dur) => EaseMethods.CubicEaseOut(step, 0, 1, dur);
        fadeOut = (float step, float dur) => EaseMethods.CubicEaseIn(dur - step, 0, 1, dur);

        //Invoke("ChangeSeasons", dayDuration);
        StartCoroutine(ChangeSeasons(dayDuration));
    }
Exemplo n.º 2
0
    /// <summary> expands and collapses bubble </summary>
    IEnumerator Bubble(bool entering, float dur, Vector2 pos = default(Vector2))
    {
        active = entering;
        if (entering)
        {
            bubble.SetActive(true);
        }
        for (var(start, step) = (Time.time, 0f); step < dur; step = Time.time - start)
        {
            yield return(null);

            float scale = entering ?
                          EaseMethods.CubicEaseOut(step / dur, minSize, size, size) :
                          EaseMethods.CubicEaseIn(1 - step / dur, minSize, size, size);
            bubble.transform.localScale = scale * Vector3.one;
            col.radius = scale / size * 7 + 3;
            // bubble.transform.localPosition = entering ? Vector3.Lerp(transform.position, startPos, step / dur) : Vector3.Lerp(startPos, transform.position, step / dur);
        }
        if (!entering)
        {
            bubble.SetActive(false);
        }
    }