Example #1
0
    IEnumerator Scale()
    {
        var from = fromScale;
        var to   = toScale;

        if (moveType == MoveType.Loop)
        {
            while (true)
            {
                transform.localScale = MoverCommon.Loop(duration, from, to, offset);
                yield return(0);
            }
        }
        else
        {
            while (true)
            {
                transform.localScale = MoverCommon.Wave(duration, from, to, offset);
                yield return(0);
            }
        }
    }
Example #2
0
    IEnumerator Position()
    {
        var from = transform.localPosition + fromPosition;
        var to   = transform.localPosition + toPosition;

        if (moveType == MoveType.Loop)
        {
            while (true)
            {
                transform.localPosition = MoverCommon.Loop(duration, from, to, offset);
                yield return(0);
            }
        }
        else
        {
            while (true)
            {
                transform.localPosition = MoverCommon.Wave(duration, from, to, offset);
                yield return(0);
            }
        }
    }
Example #3
0
    IEnumerator Rotation()
    {
        var from = transform.localRotation * Quaternion.Euler(fromRotation);
        var to   = transform.localRotation * Quaternion.Euler(toRotation);

        if (moveType == MoveType.Loop)
        {
            while (true)
            {
                transform.localRotation = MoverCommon.Loop(duration, from, to, offset);
                yield return(0);
            }
        }
        else
        {
            while (true)
            {
                transform.localRotation = MoverCommon.Wave(duration, from, to, offset);
                yield return(0);
            }
        }
    }
Example #4
0
    IEnumerator MoveOnPath()
    {
        int index = startIndex;

        transform.localPosition = points[index];
        while (true)
        {
            index = (index + 1) % points.Length;
            Vector3 localPoint = new Vector3(points[index].x, transform.localPosition.y, points[index].z);
            transform.LookAt(localPoint);
            yield return(StartCoroutine(transform.MoveTo(localPoint, moveDuration, moveEase)));

            if (stopTweenDuration > 0)
            {
                StartCoroutine(transform.ScaleFrom(stopScale, stopTweenDuration, stopEase));
            }
            if (stopDuration > 0)
            {
                yield return(StartCoroutine(MoverCommon.Wait(stopDuration)));
            }
        }
    }