31 lines
844 B
C#
31 lines
844 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.InputSystem;
|
||
|
using TMPro;
|
||
|
|
||
|
public class DialogBoxes : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
[Header("Dialog Messages:")]
|
||
|
[SerializeField] string[] dialogMessages;
|
||
|
private TMP_Text textField;
|
||
|
private int messageCount = 0;
|
||
|
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
textField = this.gameObject.GetComponent<TMP_Text>();
|
||
|
textField.text = dialogMessages[0];
|
||
|
}
|
||
|
|
||
|
void OnAdvanceDialog() {
|
||
|
messageCount += 1;
|
||
|
if (messageCount < dialogMessages.Length) {
|
||
|
textField.text = dialogMessages[messageCount];
|
||
|
} else { // no more dialog messages, advance the scene
|
||
|
GameObject.Find("SceneManager").GetComponent<SceneController>().NextScene();
|
||
|
}
|
||
|
}
|
||
|
}
|