using System; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class introCutsceneDialog : MonoBehaviour { private int currentDialog = 0; public GameObject dialogBoxObject; public GameObject dialogTextObject; public AudioSource soundGroundCollapse; public AudioSource soundFall; public AudioSource soundShake; private string[] dialogs = new string[7] { "K-41: Well... this shouldn't be happening.", "K-41: It seems that I've fallen out of my game through a memory leak.", "K-41: There should be a portal somewhere down here...", "K-41: It should take me home.", "K-41: It probably even has a flashing arrow pointing right at it...", "K-41: Anyway... I could really use some help with this...", "" }; public void Update() { if (Input.GetButtonDown("Submit")) { nextDialog(); } } public void nextDialog() { dialogBoxObject.SetActive(true); dialogTextObject.GetComponent().text = dialogs[currentDialog]; currentDialog++; if (currentDialog >= dialogs.Length) { dialogEnd(); } } public void dialogEnd() { SceneManager.LoadScene("level1"); } public void soundPlay(int a) { switch (a) { case 1: soundFall.Play(); break; case 2: soundGroundCollapse.Play(); break; case 3: soundShake.Play(); break; } } }