basically the whole game
This commit is contained in:
parent
949135cecb
commit
96dcfa9064
315 changed files with 34386 additions and 396 deletions
58
Assets/Scripts/CutsceneManager.cs
Normal file
58
Assets/Scripts/CutsceneManager.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CutsceneManager : MonoBehaviour
|
||||
{
|
||||
[Header("Status")]
|
||||
public DialogueScript scriptToShow;
|
||||
public int currentText;
|
||||
[Header("UI")]
|
||||
public TextMeshProUGUI nameText;
|
||||
public TextMeshProUGUI dialogueText;
|
||||
public Image sceneImage;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCutscene(LevelSwitcher.instance.currentScript);
|
||||
}
|
||||
|
||||
public void StartCutscene(DialogueScript newDialogue)
|
||||
{
|
||||
currentText = 0;
|
||||
scriptToShow = newDialogue;
|
||||
DialogueScript.Dialogue currentDialogue = scriptToShow.dialogueList[currentText];
|
||||
nameText.text = currentDialogue.character.name;
|
||||
sceneImage.sprite = currentDialogue.cutsceneImage;
|
||||
dialogueText.text = currentDialogue.text;
|
||||
dialogueText.color = currentDialogue.character.textColor; //probably should make current dialogue a variable lol
|
||||
}
|
||||
|
||||
public void ContinueDialogue()
|
||||
{
|
||||
currentText++;
|
||||
if (currentText >= scriptToShow.dialogueList.Length)
|
||||
{
|
||||
EndDialogue();
|
||||
return;
|
||||
}
|
||||
DialogueScript.Dialogue currentDialogue = scriptToShow.dialogueList[currentText];
|
||||
nameText.text = currentDialogue.character.characterName;
|
||||
sceneImage.sprite = currentDialogue.cutsceneImage;
|
||||
dialogueText.text = currentDialogue.text;
|
||||
}
|
||||
|
||||
public void EndDialogue()
|
||||
{
|
||||
LevelSwitcher.instance.SwitchLevel(scriptToShow.nextScene);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
ContinueDialogue();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue