コード例 #1
0
ファイル: ElasticTouch.cs プロジェクト: n0mimono/Book0
    private IEnumerator FlickAction(Vector3 pos, Vector3 vec)
    {
        Vector3 org = pos - vec;

        bool isWeak  = vec.magnitude < flickDistance;
        bool isDist  = vec.Similarity (st.Vec) < elasticDotSimilarity;
        bool isShort = st.Vec.magnitude < elasticDistance;
        if (isWeak || isDist || isShort) {
            yield break;
        }
        Color effectColor = flickColor;

        StartCoroutine(ripple(org, effectColor));
        StartCoroutine(ripple(pos, effectColor));
        yield return null;
        handler.OnFlicked (vec);

        SetPos (org);
        SetStretch (vec.magnitude * stretchScale);
        SetDirection (vec.normalized);

        SetTargetColor (effectColor);
        SetTargetAlpha (1f);
        SetCurrentAlpha (0f);

        yield return new WaitForSeconds(0.3f);
        SetTargetColor (Color.white);
        SetTargetAlpha (0f);
    }