Beispiel #1
0
    private IEnumerator MoveRabbit(Vector3 startPos, Vector3 endPos, float duration)
    {
        float elapsedTime = 0;
        float ratio       = elapsedTime / duration;

        while (ratio < 1f)
        {
            elapsedTime       += Time.deltaTime;
            ratio              = elapsedTime / duration;
            transform.position = Vector3.Lerp(startPos, endPos, ratio);
            yield return(null);
        }
        m_animator.SetInteger("AnimIndex", Idle);
        m_animator.SetTrigger("Next");
        canJump = true;
        if (activeColorDot.hasCarrot)
        {
            activeColorDot.hideCarrot();
            FindObjectOfType <RabbitJumpController>().PickUpCarrot();
        }
    }