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
    private void Progress()
    {
        if (dialogue.End())
        {
            InputManager.Instance.ChangeInput(InputType.Move);
            rootPanel.SetActive(false);
        }

        dialogue.Next();
    }
Ejemplo n.º 3
0
 public void Update()
 {
     if (!active)
     {
         return;
     }
     nextEnd = dialogues.End();
     if (dialogues.GetChoices().Length != 0)
     {
         if (showingText)
         {
             ShowOther();
         }
         if (Input.GetButtonDown("Choice 1"))
         {
             Debug.Log("Choice 1");
             Choice(0);
         }
         else if (Input.GetButtonDown("Choice 2"))
         {
             Debug.Log("Choice 2");
             Choice(1);
         }
         else if (Input.GetButtonDown("Choice 3"))
         {
             Debug.Log("Choice 3");
             Choice(2);
         }
     }
     else
     {
         if (!showingText)
         {
             ShowOther();
         }
         if (Input.GetButtonDown("Interact"))
         {
             if (!nextEnd)
             {
                 dialogues.Next();
                 dialogueText.text = dialogues.GetCurrentDialogue();
             }
             else
             {
                 Hide();
             }
         }
     }
 }
Ejemplo n.º 4
0
    public void NextDialogue()
    {
        if (npc.End())
        {
            DialogueBox.SetActive(false);
            npc = null;

            PlayerStatus pStatus = GetComponent <Player>().PlayerStatus;
            pStatus.CanWalk     = true;
            pStatus.canInteract = true;
            pStatus.isTalking   = false;

            return;
        }
        npc.Next();
        text.text = npc.GetCurrentDialogue();
    }
Ejemplo n.º 5
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;
        }
    }