private void ManagePopupVisibility()
{
var shouldShow = true;
if(pawnSearching == null) shouldShow = false; // if there is no pawn hiding, don't show the popup
if(DialogueManager.instance != null && DialogueManager.isConversationActive) shouldShow = false; // if there is a conversation, don't show the popup (to prevent overlaping)
if(_popup.IsShowing && _popup.IsVisible) shouldShow = false; // if the popup is already showing, don't show it again
if(shouldShow)
{
_popup.Show();
}
else
{
_popup.Hide();
}
}
That works pretty well. I would like to use something like
void OnStart() {
_barkWatcher = DialogueManager.instance.transform.GetComponent<BarkWatcher>();
}
/// On another function
if(_barkWatcher.IsBarkActive()) shouldShow = false;