Esempio n. 1
0
    // if a dialogue is open and I click on submit,
    // I stop text animation and with another click I go to the next string or I close dialogue
    // If I click Escape (optionally) I immediately close dialogue
    void Update()
    {
        if (!DialogueBox.activeSelf)
        {
            return;
        }

        if (Input.GetButtonDown("Submit") || Input.GetButtonDown("Jump"))
        {
            if (textComponent.text == GlobalVariables.Dialogues[index])
            {
                NextImg.SetActive(false);
                ExitImg.SetActive(false);
                NextLine();
            }
            else
            {
                if (coroutine != null)
                {
                    StopCoroutine(coroutine);
                }
                textComponent.text = GlobalVariables.Dialogues[index];
                ShowNextImg();
            }
        }
        else if (Input.GetButtonDown("Escape"))
        {
            if (coroutine != null)
            {
                StopCoroutine(coroutine);
            }
            StartCoroutine(DelayEnableInput()); // I delay enable input because player still receive input (is not in pause)
            DialogueBox.SetActive(false);
        }
    }
Esempio n. 2
0
 // disable all objects on start
 void Start()
 {
     DialogueBox.SetActive(false);
     NextImg.SetActive(false);
     ExitImg.SetActive(false);
     textComponent.text = string.Empty;
 }
Esempio n. 3
0
 // If this is the last string I show the exit image, otherwise I show the next image
 private void ShowNextImg()
 {
     if (index == endIndex)
     {
         ExitImg.SetActive(true);
     }
     else
     {
         NextImg.SetActive(true);
     }
 }