Ejemplo n.º 1
0
    private void Moving()
    {
        if (!isMove)
        {
            return;
        }

        moveTime += Time.deltaTime;
        float posY;

        if (moveTime < 0.5f)
        {
            posY = easing.CubicOut(easing.DelayTime(moveTime, 0.0f, 0.5f),
                                   originPosY,
                                   originPosY + jumpSpeed);
        }
        else
        {
            posY = easing.CubicIn(easing.DelayTime(moveTime, 0.5f, 0.5f),
                                  originPosY + jumpSpeed,
                                  originPosY);
        }


        transform.localPosition = new Vector3(
            transform.localPosition.x,
            posY,
            transform.localPosition.z);
        if (moveTime >= 1.0f)
        {
            moveTime = 0.0f;
            isMove   = false;
        }
    }
Ejemplo n.º 2
0
    void LateUpdate()
    {
        float pitch = GetPitch();

        // Tine position
        float goalY = -48 - 120 / pitch;
        float y     = Mathf.Lerp(container.anchoredPosition.y, goalY, 0.5f);

        container.anchoredPosition = new Vector2(container.anchoredPosition.x, y);

        // Tine vibration
        float x = 0;

        if (source.isPlaying)
        {
            float progress = source.time / noteSound.length;
            x = Mathf.Cos(Time.time * pitch * 100) * Easing.CubicOut(1 - progress);
        }
        image.rectTransform.anchoredPosition = Vector3.right * x;

        // Tine colour if held down
        if (state == State.PRESSED)
        {
            image.color = LIGHT_GREY;
        }
        else
        {
            image.color = Color.white;
        }

        // Tine note
        note.text = GetNoteString();
    }
Ejemplo n.º 3
0
Archivo: Phone.cs Proyecto: dvdfu/ld47
    IEnumerator ShowInstructionsRoutine()
    {
        instructions.color = Color.white;
        yield return(new WaitForSeconds(6));

        while (countdown.IsStopped() || onFire)
        {
            yield return(null);
        }
        Color clear = new Color(1, 1, 1, 0);

        yield return(Tween.StartRoutine(0.5f, (float progress) => {
            instructions.color = Color.Lerp(Color.white, clear, Easing.CubicOut(progress));
        }));
    }
Ejemplo n.º 4
0
    IEnumerator ReleaseRoutine()
    {
        animator.Play("Sing");
        float t = 0;

        while (t < 0.5f)
        {
            t += Time.deltaTime;
            float progress = t / 0.5f;
            float scale    = 1 - 0.1f * Mathf.Cos(Time.time * 100) * Easing.CubicOut(1 - progress);
            hole.localScale = new Vector3(scale, 1 / scale, 1);
            yield return(null);
        }
        hole.localScale = new Vector3(1, 1, 1);
        animator.Play("Idle");
    }
Ejemplo n.º 5
0
        public void CubicOut()
        {
            Utils.AreEqual(
                0f,
                Easing.CubicOut(0f)
                );

            Utils.AreEqual(
                1f,
                Easing.CubicOut(1f)
                );

            Assert.AreEqual(
                0.875f,
                Easing.CubicOut(0.5f)
                );
        }
Ejemplo n.º 6
0
    IEnumerator TapRoutine()
    {
        yield return(new WaitForSeconds(0.2f));

        animator.Play("Hold");
        float t = 0;

        while (t < 0.2f)
        {
            t += Time.deltaTime;
            float progress = t / 0.2f;
            float scale    = 1 + 0.2f * Easing.CubicOut(1 - progress);
            hole.localScale = new Vector3(scale, 1 / scale, 1);
            yield return(null);
        }
        hole.localScale = new Vector3(1, 1, 1);
    }
Ejemplo n.º 7
0
    IEnumerator RefreshRoutine()
    {
        refreshText.text = "Loading...";
        refresh.GetComponent <Button>().interactable = false;
        Vector2 refreshSize = refresh.sizeDelta;

        yield return(Tween.StartRoutine(0.2f, (float progress) => {
            float height = Mathf.Lerp(refreshSize.y, 60, Easing.CubicIn(progress));
            refresh.sizeDelta = new Vector2(refreshSize.x, height);
        }));

        yield return(new WaitForSeconds(0.6f));

        yield return(Tween.StartRoutine(0.2f, (float progress) => {
            float height = Mathf.Lerp(60, 0, Easing.CubicOut(progress));
            refresh.sizeDelta = new Vector2(refreshSize.x, height);
        }));

        phone.ResetCountdown();
        int count = Random.Range(3, 6);

        gameData.postsLeft = count;
        for (int i = 0; i < count; i++)
        {
            Instantiate(postPrefab, feed).transform.SetSiblingIndex(0);
            SoundManager.instance.Play(postSound);
            if (feed.transform.childCount > 10)
            {
                Destroy(feed.transform.GetChild(10).gameObject);
            }
            yield return(new WaitForSeconds(0.1f));
        }

        while (gameData.postsLeft > 0)
        {
            yield return(null);
        }
        isRefreshing     = false;
        refreshText.text = "See More";
        refresh.GetComponent <Button>().interactable = true;
        yield return(Tween.StartRoutine(0.2f, (float progress) => {
            float height = Mathf.Lerp(0, 30, Easing.CubicIn(progress));
            refresh.sizeDelta = new Vector2(refreshSize.x, height);
        }));
    }
Ejemplo n.º 8
0
    IEnumerator SubmitRoutine()
    {
        submitButton.interactable = false;
        slider1.interactable      = false;
        slider2.interactable      = false;
        phone.CompleteTask();
        SoundManager.instance.Play(correctSound);
        successScreen.gameObject.SetActive(true);
        yield return(Tween.StartRoutine(0.3f, (float progress) => {
            successScreen.anchoredPosition = Vector2.down * 300 * Easing.CubicOut(1 - progress);
        }));

        yield return(new WaitForSeconds(0.5f));

        NewPhoto();
        slider1.value = 0;
        slider2.value = 0;
        yield return(Tween.StartRoutine(0.3f, (float progress) => {
            successScreen.anchoredPosition = Vector2.up * 300 * Easing.CubicOut(progress);
        }));

        successScreen.gameObject.SetActive(false);
    }
Ejemplo n.º 9
0
    IEnumerator AnimLeftBlue(float seconds)
    {
        //!< 時間計測開始
        ProcessTimer processTimer = new ProcessTimer();

        processTimer.Restart();

        //!< 保存用
        Vector3 pos = this.gameObject.transform.position;
        //!< ラジアンに変換 (3.0度→)
        float rad = 3.0f * Mathf.Deg2Rad;

        while (seconds > processTimer.TotalSeconds)
        {
            float move = Easing.CubicOut(processTimer.TotalSeconds, seconds, -1100, 0.0f);
            this.gameObject.transform.localPosition = new Vector3(move * Mathf.Sin(rad), move * Mathf.Cos(rad), 0);

            // 継続
            yield return(null);
        }

        // 調整用
        this.gameObject.transform.position = pos;
    }
Ejemplo n.º 10
0
    public IEnumerator StartEventing()
    {
        //!< 時間計測開始
        float        seconds      = 1.0f;
        ProcessTimer processTimer = new ProcessTimer();
        //!< 色情報取得
        Image image = this.GetComponent <Image>();
        Color col   = image.color;

        //=====================================================
        // 右から登場+縦サイズ変更+α値↑
        //=====================================================
        seconds = 0.6f;
        processTimer.Restart();
        while (seconds > processTimer.TotalSeconds)
        {
            // QuadIn
            float x = Easing.BackOut(processTimer.TotalSeconds, seconds, 500.0f, 0.0f, 1.0f);
            float h = Easing.QuartOut(processTimer.TotalSeconds, seconds, 0.3f, 1.0f);
            float a = Easing.QuartOut(processTimer.TotalSeconds, seconds, 0.2f, 1.0f);

            this.transform.localPosition = new Vector3(x, 0, 0);
            this.transform.localScale    = new Vector3(1.0f, h, 1.0f);
            image.color = new Color(col.r, col.g, col.b, a);
            // 継続
            yield return(null);
        }
        // 調整用
        this.transform.localPosition = new Vector3(0, 0, 0);
        this.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
        image.color = new Color(col.r, col.g, col.b, 1.0f);

        //=====================================================
        // 待機
        //=====================================================
        yield return(new WaitForSecondsRealtime(0.1f));

        //=====================================================
        // サイズ縮小+α値↓
        //=====================================================
        seconds = 0.35f;
        processTimer.Restart();
        while (seconds > processTimer.TotalSeconds)
        {
            // QuadIn
            float wh = Easing.CubicOut(processTimer.TotalSeconds, seconds, 1.0f, 0.6f);
            float a  = Easing.SineIn(processTimer.TotalSeconds, seconds, 1.0f, 0.5f);

            this.transform.localScale = new Vector3(wh, wh, 1.0f);
            image.color = new Color(col.r, col.g, col.b, a);

            // 継続
            yield return(null);
        }
        // 調整用
        this.transform.localScale = new Vector3(0.6f, 0.6f, 1.0f);
        image.color = new Color(col.r, col.g, col.b, 0.5f);

        //=====================================================
        // サイズ拡大+α値↓
        //=====================================================
        seconds = 0.45f;
        processTimer.Restart();
        while (seconds > processTimer.TotalSeconds)
        {
            // QuadIn
            float wh = Easing.CubicOut(processTimer.TotalSeconds, seconds, 0.6f, 1.6f);
            float a  = Easing.SineIn(processTimer.TotalSeconds, seconds, 0.5f, 0.0f);

            this.transform.localScale = new Vector3(wh, wh, 1.0f);
            image.color = new Color(col.r, col.g, col.b, a);

            if (!isStart)
            {
                if (wh >= 1.0f)
                {
                    // 本編動き出す
                    StageManager.Instance.SetFlg(StageFlg.NOMAL);
                    isStart = true;
                }
            }

            // 継続
            yield return(null);
        }
        // 調整用
        //this.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
        //image.color = new Color(col.r, col.g, col.b, 0.0f);

        //Destroy(this.gameObject);
    }
Ejemplo n.º 11
0
    private void Move()
    {
        float xx = (endX - startX) * time / easingTime;
        float yy = 0.0f;

        switch (type)
        {
        case EasingType.Constant:
            yy = endY;
            break;

        case EasingType.QuadIn:
            yy = Easing.QuadIn(time, easingTime, startY, endY);
            break;

        case EasingType.QuadOut:
            yy = Easing.QuadOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuadInOut:
            yy = Easing.QuadInOut(time, easingTime, startY, endY);
            break;

        case EasingType.CubicIn:
            yy = Easing.CubicIn(time, easingTime, startY, endY);
            break;

        case EasingType.CubicOut:
            yy = Easing.CubicOut(time, easingTime, startY, endY);
            break;

        case EasingType.CubicInOut:
            yy = Easing.CubicInOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuartIn:
            yy = Easing.QuartIn(time, easingTime, startY, endY);
            break;

        case EasingType.QuartOut:
            yy = Easing.QuartOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuartInOut:
            yy = Easing.QuartInOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuintIn:
            yy = Easing.QuintIn(time, easingTime, startY, endY);
            break;

        case EasingType.QuintOut:
            yy = Easing.QuintOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuintInOut:
            yy = Easing.QuintInOut(time, easingTime, startY, endY);
            break;

        case EasingType.SineIn:
            yy = Easing.SineIn(time, easingTime, startY, endY);
            break;

        case EasingType.SineOut:
            yy = Easing.SineOut(time, easingTime, startY, endY);
            break;

        case EasingType.SineInOut:
            yy = Easing.SineInOut(time, easingTime, startY, endY);
            break;

        case EasingType.ExpIn:
            yy = Easing.ExpIn(time, easingTime, startY, endY);
            break;

        case EasingType.ExpOut:
            yy = Easing.ExpOut(time, easingTime, startY, endY);
            break;

        case EasingType.ExpInOut:
            yy = Easing.ExpInOut(time, easingTime, startY, endY);
            break;

        case EasingType.CircIn:
            yy = Easing.CircIn(time, easingTime, startY, endY);
            break;

        case EasingType.CircOut:
            yy = Easing.CircOut(time, easingTime, startY, endY);
            break;

        case EasingType.CircInOut:
            yy = Easing.CircInOut(time, easingTime, startY, endY);
            break;

        case EasingType.ElasticIn:
            yy = Easing.ElasticIn(time, easingTime, startY, endY);
            break;

        case EasingType.ElasticOut:
            yy = Easing.ElasticOut(time, easingTime, startY, endY);
            break;

        case EasingType.ElasticInOut:
            yy = Easing.ElasticInOut(time, easingTime, startY, endY);
            break;

        case EasingType.BackIn:
            yy = Easing.BackIn(time, easingTime, startY, endY, 1.7f);
            break;

        case EasingType.BackOut:
            yy = Easing.BackOut(time, easingTime, startY, endY, 1.7f);
            break;

        case EasingType.BackInOut:
            yy = Easing.BackInOut(time, easingTime, startY, endY, 1.7f);
            break;

        case EasingType.BounceIn:
            yy = Easing.BounceIn(time, easingTime, startY, endY);
            break;

        case EasingType.BounceOut:
            yy = Easing.BounceOut(time, easingTime, startY, endY);
            break;

        case EasingType.BounceInOut:
            yy = Easing.BounceInOut(time, easingTime, startY, endY);
            break;

        case EasingType.Linear:
            yy = Easing.Linear(time, easingTime, startY, endY);
            break;
        }

        if (float.IsNaN(yy))
        {
            yy = 1;
        }

        ball.transform.position = new Vector3(startX + xx, yy, 0);
    }
Ejemplo n.º 12
0
 public System.Func <float, float> GetEaseAction(EzEaseType type)
 {
     if (type == EzEaseType.SineIn)
     {
         return((v) => Easing.SineIn(v));
     }
     else if (type == EzEaseType.SineOut)
     {
         return((v) => Easing.SineOut(v));
     }
     else if (type == EzEaseType.SineInOut)
     {
         return((v) => Easing.SineInOut(v));
     }
     else if (type == EzEaseType.QuadIn)
     {
         return((v) => Easing.QuadIn(v));
     }
     else if (type == EzEaseType.QuadOut)
     {
         return((v) => Easing.QuadOut(v));
     }
     else if (type == EzEaseType.QuadInOut)
     {
         return((v) => Easing.QuadInOut(v));
     }
     else if (type == EzEaseType.CubicIn)
     {
         return((v) => Easing.CubicIn(v));
     }
     else if (type == EzEaseType.CubicOut)
     {
         return((v) => Easing.CubicOut(v));
     }
     else if (type == EzEaseType.CubicInOut)
     {
         return((v) => Easing.CubicInOut(v));
     }
     else if (type == EzEaseType.QuartIn)
     {
         return((v) => Easing.QuartIn(v));
     }
     else if (type == EzEaseType.QuartOut)
     {
         return((v) => Easing.QuartOut(v));
     }
     else if (type == EzEaseType.QuartInOut)
     {
         return((v) => Easing.QuartInOut(v));
     }
     else if (type == EzEaseType.ExpIn)
     {
         return((v) => Easing.ExpIn(v));
     }
     else if (type == EzEaseType.ExpOut)
     {
         return((v) => Easing.ExpOut(v));
     }
     else if (type == EzEaseType.ExpInOut)
     {
         return((v) => Easing.ExpInOut(v));
     }
     else if (type == EzEaseType.CircIn)
     {
         return((v) => Easing.CircIn(v));
     }
     else if (type == EzEaseType.CircOut)
     {
         return((v) => Easing.CircOut(v));
     }
     else if (type == EzEaseType.CircInOut)
     {
         return((v) => Easing.CircInOut(v));
     }
     else if (type == EzEaseType.ElasticIn)
     {
         return((v) => Easing.ElasticIn(v));
     }
     else if (type == EzEaseType.ElasticOut)
     {
         return((v) => Easing.ElasticOut(v));
     }
     else if (type == EzEaseType.ElasticInOut)
     {
         return((v) => Easing.ElasticInOut(v));
     }
     else if (type == EzEaseType.BackIn)
     {
         return((v) => Easing.BackIn(v));
     }
     else if (type == EzEaseType.BackOut)
     {
         return((v) => Easing.BackOut(v));
     }
     else if (type == EzEaseType.BackInOut)
     {
         return((v) => Easing.BackInOut(v));
     }
     else if (type == EzEaseType.BounceIn)
     {
         return((v) => Easing.BounceIn(v));
     }
     else if (type == EzEaseType.BounceOut)
     {
         return((v) => Easing.BounceOut(v));
     }
     else if (type == EzEaseType.BounceInOut)
     {
         return((v) => Easing.BounceInOut(v));
     }
     else
     {
         return((v) => Easing.Linear(v));
     }
 }