void Start() { transition = GetComponent <SceneTransition>(); currentImage = 0; Display.sprite = Images[currentImage]; Dialogue.SetTree(DialogueName); DialogueText.text = Dialogue.GetCurrentDialogue(); }
public void StartInteraction(GameObject obj, string str, int random_responses, int index = -1) { active = true; interactable = obj.GetComponent <Interactable>(); if (interactable.isPerson) { portrait.GetComponent <Image>().sprite = interactable.portrait; portraitItem.SetActive(false); portrait.SetActive(true); } else { portraitItem.GetComponent <Image>().sprite = interactable.portrait; portraitItem.SetActive(true); portrait.SetActive(false); } interactable.Interact(); dialogues = interactable.GetComponent <Dialogues>(); if (index == -1) { if (random_responses > 0) { int ind = Random.Range(0, random_responses); dialogues.SetTree(ind.ToString()); } else { dialogues.SetTree(str); } } else { dialogues.SetTree(index.ToString()); } dialogues.Reset(); dialogueText.text = dialogues.GetCurrentDialogue(); dialogueUI.SetActive(true); }
// Simple Dialogues // // This is a basic example of how you can use the dialogue system. // void Start() { npc.SetTree("FirstMeeting"); //This sets the current tree to be used. Resets to the first node when called. Display(); }