added transition scene with basic tutorial AND PERSISTENT DATA
PLEASE launch game from the main menu scene, otherwise persistent data will not load correctly
This commit is contained in:
30
Assets/Scripts/DialogBoxes.cs
Normal file
30
Assets/Scripts/DialogBoxes.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user