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

66 lines
1.6 KiB
C#
Raw Normal View History

2021-11-01 23:29:54 -06:00
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
2022-10-07 14:54:24 -06:00
public class IntroCutsceneDialog : MonoBehaviour
2021-11-01 23:29:54 -06:00
{
private int currentDialog = 0;
public GameObject dialogBoxObject;
public GameObject dialogTextObject;
public AudioSource soundGroundCollapse;
public AudioSource soundFall;
2021-11-01 23:47:10 -06:00
public AudioSource soundShake;
2021-11-01 23:29:54 -06:00
private string[] dialogs = new string[7]
{
"K-41: Well... this shouldn't be happening.",
2021-11-01 23:47:10 -06:00
"K-41: It seems that I've fallen out of my game through a memory leak.",
2021-11-01 23:29:54 -06:00
"K-41: There should be a portal somewhere down here...",
2021-11-01 23:47:10 -06:00
"K-41: It should take me home.",
2021-11-01 23:55:30 -06:00
"K-41: It probably even has a flashing arrow pointing at it...",
2021-11-01 23:29:54 -06:00
"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;
2021-11-01 23:47:10 -06:00
case 3:
soundShake.Play();
break;
2021-11-01 23:29:54 -06:00
}
}
}