Пример #1
0
    public void Move()
    {
        move = false;
        BoulderMovement movement = movements[currMovement];
        Vector3         endPos   = transform.position + movement.offset;

        Coroutine rotation = null;

        rotation = StartCoroutine(MovementUtils.SmoothRotationConst(boulder, Vector3.back, movement.rotSpeed));

        StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
            if (rotation != null)
            {
                StopCoroutine(rotation);
            }
            if (!movement.onGround)
            {
                PlaySoundInterval(impactAudio, 0, 0.5f);
            }
            currMovement++;
            move = true;
        }, gameObject, endPos, movement.speed));

        //Play or dust ps
        if (movement.onGround)
        {
            rollingAudio.Play();
            dust.Play();
        }
        else
        {
            rollingAudio.Stop();
            dust.Stop();
        }
    }