// Start is called before the first frame update void Start() { count = 0; talk = false; now = GameManager.Chapter.Begin_movie; readFile(now.ToString()); }
// Update is called once per frame void Update() { if (now != gameManager.chapter) { count = 0; now = gameManager.chapter; readFile(now.ToString()); if (sentence.Count > 0) { talk = true; dialog.SetActive(true); dialogText.GetComponent <TypewriterEffect>().newWords = sentence[count]; } } if (Input.GetKeyDown(KeyCode.Space) && talk) { if (dialogText.GetComponent <TypewriterEffect>().isActive) { dialogText.GetComponent <TypewriterEffect>().OnFinish(); } else { count++; if (count < sentence.Count) { dialogText.GetComponent <TypewriterEffect>().newWords = sentence[count]; } else { talk = false; dialogText.GetComponent <Text>().text = ""; dialog.SetActive(false); } } } }