private void RunTheyDialogue(PlainDialogue theyDialogue) { theyPanelText.text = theyDialogue.displayedText; theyPanelSprite.sprite = sprites[theyDialogue.spriteId]; nextDialogue = theyDialogue.next; theyPanel.SetActive(true); }
private void RunMeDialogue(PlainDialogue meDialogue) { mePanelText.text = meDialogue.displayedText; mePanelSprite.sprite = sprites[meDialogue.spriteId]; nextDialogue = meDialogue.next; mePanel.SetActive(true); }
// A manually constructed Dialogue tree for testing public static Dialogue GetTestDialogue() { Dialogue endHappy = new PlainDialogue(true, 0, "I'm great, thank you!"); Dialogue endRude = new PlainDialogue(true, 0, "Keep quiet! Silence in the restaurant please."); Dialogue choice = new ChoiceDialogue(new Dialogue[] { endHappy, endRude }, new string[] { "Great (Happy)", "Keep quiet (Rude)" }); Dialogue initial = new PlainDialogue(false, 1, "How are you today?", choice); return(initial); }
// Checks what kind of dialogue it is and calls the correct function. // Returns the next dialogue, or null, if it is the last dialogue. private void RunCurrentDialogue() { if (currentDialogue.isPlain) { PlainDialogue plain = (PlainDialogue)currentDialogue; if (plain.isPlayer) { RunMeDialogue(plain); } else { RunTheyDialogue(plain); } } else { ChoiceDialogue choice = (ChoiceDialogue)currentDialogue; RunChoiceDialogue(choice); } }