gimm-platformer-project/Assets/Scripts/introCutsceneDialog.cs

63 lines
1.5 KiB
C#
Raw Normal View History

2021-11-01 23:29:54 -06:00
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;
private string[] dialogs = new string[7]
{
"K-41: Well... this shouldn't be happening.",
"K-41: It seems like I've fallen out of my game through a memory leak.",
"K-41: There should be a portal somewhere down here...",
"K-41: That should take me home.",
"K-41: It probably 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>().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;
}
}
}