Ejemplo n.º 1
0
    public void NextDialogue()
    {
        if (Dialogue.End())
        {
            transition.ChangeScene();
        }

        if (Dialogue.HasTrigger())
        {
            if (Dialogue.GetTrigger() == "Change Image")
            {
                currentImage++;
                Display.sprite = Images[currentImage];
            }
            if (Dialogue.GetTrigger() == "Hide Text")
            {
                Textbox.SetActive(false);
            }
            if (Dialogue.GetTrigger() == "Show Text")
            {
                Textbox.SetActive(true);
            }
        }
        Dialogue.Next();
        DialogueText.text = Dialogue.GetCurrentDialogue();
    }
Ejemplo n.º 2
0
    public void Display()
    {
        if (nextEnd == true)
        {
            backPanel.SetActive(false);
            nextTreeButton.SetActive(true);
        }
        else
        {
            backPanel.SetActive(true);
            nextTreeButton.SetActive(false);
        }

        //Sets our text to the current text
        dialogueText.text = npc.GetCurrentDialogue();
        //Just debug log our triggers for example purposes
        if (npc.HasTrigger())
        {
            Debug.Log("Triggered: " + npc.GetTrigger());
        }
        //This checks if there are any choices to be made
        if (npc.GetChoices().Length != 0)
        {
            //Setting the text's of the buttons to the choices text, in my case I know I'll always have a max of three choices for this example.
            leftText.text   = npc.GetChoices()[0];
            middleText.text = npc.GetChoices()[1];
            //If we only have two choices, adjust accordingly
            if (npc.GetChoices().Length > 2)
            {
                rightText.text = npc.GetChoices()[2];
            }
            else
            {
                rightText.text = npc.GetChoices()[1];
            }
            //Setting the appropriate buttons visability
            leftText.transform.parent.gameObject.SetActive(true);
            rightText.transform.parent.gameObject.SetActive(true);
            if (npc.GetChoices().Length > 2)
            {
                middleText.transform.parent.gameObject.SetActive(true);
            }
            else
            {
                middleText.transform.parent.gameObject.SetActive(false);
            }
        }
        else
        {
            middleText.text = "Continue";
            //Setting the appropriate buttons visability
            leftText.transform.parent.gameObject.SetActive(false);
            rightText.transform.parent.gameObject.SetActive(false);
            middleText.transform.parent.gameObject.SetActive(true);
        }

        if (npc.End()) //If this is the last dialogue, set it so the next time we hit "Continue" it will hide the panel
        {
            nextEnd = true;
        }
    }