1 using System.Collections;
2 using System.Collections.Generic;
6 public class Dialogue : MonoBehaviour
8 public GameObject continueButton;
9 public GameObject dialogueBox;
10 public Text dialogueText;
11 public string[] sentences;
13 public float typingSpeed;
17 StartCoroutine(Type());
22 if (dialogueText.text == sentences[index])
24 continueButton.SetActive(true);
30 foreach (char letter in sentences[index].ToCharArray())
32 dialogueText.text += letter;
33 yield return new WaitForSeconds(typingSpeed);
37 public void NextSentence()
39 continueButton.SetActive(false);
41 if (index < sentences.Length - 1)
44 dialogueText.text = "";
45 StartCoroutine(Type());
49 dialogueText.text = "";
50 dialogueBox.SetActive(false);