Is player speaking with 1 choice. Dont show choice root but ai text

Hey there,

For the dialogue system I am trying to implent that if the player only has one choice, that the UI doen’t show the choice buttons but rather the Ai text.

      if (playerConversant.SelectChoice(DialogueNode) < 1)
            {
                AIText.text = playerConversant.GetText();
                nextButton.gameObject.SetActive(playerConversant.HasNext());
            }

I’m not positive, but this may be as simple as adding a quick method in PlayerConversant:

public bool HasMultipleChoices() =>
            FilterOnCondition(currentDialogue.GetPlayerChildren(currentNode)).Count() > 1;

and changing the if(playerConversant.IsChoosing()) to

if (playerConversant.IsChoosing() && playerConversant.HasMultipleChoices())
I copied the code you sended me still got some questions.

public bool HasMultipleChoices() => FilterOnCondition(currentDialogue.GetPlayerChildren(currentNode)).Count() > 1;

        private object FilterOnCondition(IEnumerable<DialogueNode> enumerable)
        {
            throw new NotImplementedException();
        }

On the bool I recieved an error the object does not contain a definition for count. And the FilterOnCondition method is Empty. What kind of code does there need to be in the FilterOnConditions?

Oops, that depends on code that is finished in the rest of the Dialogues and Quest course. I’d put this on hold for now and revisit it when you’ve finished the Quests section. Sam will teach filtering and conditions throughout the Quests section.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms