calling OnSelect() on ProximitySelector after the conversation?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

calling OnSelect() on ProximitySelector after the conversation?

Post by fkkcloud »

Hi,

I am using ProximitySelector/Usable/DialogueSytstemTrigger to start the conversation.
Once the conversation is done, since the player did not re-enter the collider it does not call OnSelect().

Problem is: I am using OnSelect()/OnDeselect() to show dialogue indicator that you can talk to this person or not.

What would be a better solution around this?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: calling OnSelect() on ProximitySelector after the conversation?

Post by Tony Li »

Hi,

If you're using the Usable's OnSelect() and OnDeselect(), then remember that the Usable is still selected even after the conversation. Example:

Code: Select all

bool isSelected = false;

void Selected() // <-- Assign to Usable's OnSelected() event.
{
    isSelected = true;
    canTalkIcon.SetActive(true);
}

void Deselected() // <-- Assign to Usable's OnDeselected() event.
{
    isSelected = false;
    canTalkIcon.SetActive(false);
}

void OnConversationStart(Transform actor)
{
    canTalkIcon.SetActive(false);
}

void OnConversationEnd(Transform actor)
{
    if (isSelected) canTalkIcon.SetActive(true);
}
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: calling OnSelect() on ProximitySelector after the conversation?

Post by fkkcloud »

Thanks for example! I guess that is the only way then :o
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: calling OnSelect() on ProximitySelector after the conversation?

Post by Tony Li »

Exactly. Since it's already selected, ProximitySelector has no need to call OnSelected() again.
Post Reply