Page 1 of 1

isAnyoneBarking

Posted: Tue May 23, 2023 7:48 pm
by danosono
Hi,

I want to DoSomething() only if someone is barking.

is there a bool for this?

Thanks!

Re: isAnyoneBarking

Posted: Tue May 23, 2023 8:22 pm
by Tony Li
There's no such property, but you could add a small script to the Dialogue Manager that has OnBarkStart and OnBarkEnd methods, something like:

Code: Select all

public class BarkCounter : MonoBehaviour
{
    private int numBarksActive = 0;
    
    public bool isAnyoneBarking => numBarksActive > 0;
    
    void OnBarkStart(Transform actor) { numBarksActive++; }
    void OnBarkEnd(Transform actor) { numBarksActive--; }
}

Re: isAnyoneBarking

Posted: Wed May 24, 2023 5:15 am
by danosono
Thank you sir

Re: isAnyoneBarking

Posted: Wed May 24, 2023 8:14 am
by Tony Li
Glad to help!