Page 1 of 1

calling OnSelect() on ProximitySelector after the conversation?

Posted: Mon Oct 12, 2020 8:18 pm
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?

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

Posted: Mon Oct 12, 2020 8:43 pm
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);
}

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

Posted: Mon Oct 12, 2020 9:42 pm
by fkkcloud
Thanks for example! I guess that is the only way then :o

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

Posted: Mon Oct 12, 2020 10:08 pm
by Tony Li
Exactly. Since it's already selected, ProximitySelector has no need to call OnSelected() again.