Managing the conversation

Our ConversationManager.cs class is where all the heavy lifting happens for this sample. It manages the UI for our conversation, handles events, and calculates the results for us. For the first part, we initialize our question array and then handle the UI. We set up some variables at the top of the class, which looks like this:

    [Header("UI")]    [SerializeField]    private GameObject questionPanel;    [SerializeField]    private GameObject resultPanel;    [SerializeField]    private Text resultText;    [SerializeField]    private Text questionText;    [SerializeField]    private Button firstAnswerButton;    [SerializeField]    private Button secondAnswerButton;    [SerializeField]    private Button thirdAnswerButton;

We'll be able to see the UI elements ...

Get Unity 2017 Game AI Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.