c0f9749da5
PLEASE launch game from the main menu scene, otherwise persistent data will not load correctly
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();
|
|
}
|
|
}
|
|
}
|