Ejemplo n.º 1
0
    //turns on the honk collider for a little bit and then turns it off again
    IEnumerator honk()
    {
        canHonk = false;
        sm.playHonk();

        //turns on a collider for the honk
        honkSR.enabled = true;
        honkCollider.enabled = true;

        //waits for the sound to play
        yield return new WaitForSeconds(sm.honk.length);

        //turns off collider for honk
        honkCollider.enabled = false;
        honkSR.enabled = false;

        //waits a cooldown before the goose is able to honk again
        yield return new WaitForSeconds(honkCooldown);

        canHonk = true;
    }