/// <summary> /// If there is a next text, it is played. If not, the text box is destroyed. /// </summary> public void PlayNextText() { if (counter >= speechInfos.Length) { Destroy(gameObject); return; } SpeechInfo speechInfo = speechInfos[counter]; image.sprite = speechInfo.face; speechText.text = speechInfo.text; counter++; }
/// <summary> /// Turns the npc and dialogue information and turns it into a speechInfo array. /// </summary> private void SetSpeechInfoArray() { speechInfos = new SpeechInfo[text.Length]; for (int i = 0; i < text.Length; i++) { if (playerSaysText[i]) { speechInfos[i] = new SpeechInfo(null, text[i], "Player", true); } else { speechInfos[i] = new SpeechInfo(face, text[i], npcName, false); } } }