basically the whole game
This commit is contained in:
parent
949135cecb
commit
96dcfa9064
315 changed files with 34386 additions and 396 deletions
16
Assets/Scripts/Dialogue/DialogueCharacter.cs
Normal file
16
Assets/Scripts/Dialogue/DialogueCharacter.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "New Dialogue Character", menuName = "Dialogue/Character")]
|
||||
public class DialogueCharacter : ScriptableObject
|
||||
{
|
||||
public string characterName;
|
||||
public Sprite portrait;
|
||||
public Color textColor;
|
||||
public enum Character
|
||||
{
|
||||
Reisen,
|
||||
Youmu,
|
||||
Enemy
|
||||
}
|
||||
public Character thisCharacter;
|
||||
}
|
||||
2
Assets/Scripts/Dialogue/DialogueCharacter.cs.meta
Normal file
2
Assets/Scripts/Dialogue/DialogueCharacter.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 43267f4230b9e2addaad32ec450743a5
|
||||
120
Assets/Scripts/Dialogue/DialogueManager.cs
Normal file
120
Assets/Scripts/Dialogue/DialogueManager.cs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DialogueManager : MonoBehaviour
|
||||
{
|
||||
#region Statication
|
||||
|
||||
public static DialogueManager instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
[Header("Status")]
|
||||
public DialogueScript scriptToShow;
|
||||
public int currentText;
|
||||
public bool dialogueActive;
|
||||
[Header("UI")]
|
||||
[SerializeField] private GameObject dialogueUI;
|
||||
[SerializeField] private Transform bossSpeechBubble;
|
||||
[SerializeField] private Vector3 offset;
|
||||
[SerializeField] private TextMeshProUGUI bossText;
|
||||
[SerializeField] private GameObject youmuSpeechBubble;
|
||||
[SerializeField] private TextMeshProUGUI youmuText;
|
||||
[SerializeField] private GameObject reisenSpeechBubble; //have to change the dialogue for this but it's probably fine
|
||||
[SerializeField] private TextMeshProUGUI reisenText;
|
||||
[Header("Animation")]
|
||||
[SerializeField] private Animator reisenAnimator;
|
||||
[SerializeField] private Animator youmuAnimator;
|
||||
[SerializeField] private string switchToDialogueTrigger;
|
||||
[SerializeField] private string switchToIdleTrigger;
|
||||
[SerializeField] private string changeDialogueTrigger;
|
||||
[SerializeField] private string talkTrigger;
|
||||
|
||||
|
||||
public void StartDialogue(DialogueScript newDialogue)
|
||||
{
|
||||
dialogueUI.SetActive(true);
|
||||
dialogueActive = true;
|
||||
currentText = 0;
|
||||
scriptToShow = newDialogue;
|
||||
DialogueScript.Dialogue currentDialogue = scriptToShow.dialogueList[currentText];
|
||||
bossSpeechBubble.transform.position = WaveManager.instance.bossInstance.transform.position + offset;
|
||||
SetDialogue(currentDialogue);
|
||||
reisenAnimator.SetTrigger(switchToDialogueTrigger);
|
||||
youmuAnimator.SetTrigger(switchToDialogueTrigger);
|
||||
//GameManager.instance.SetPause(true);
|
||||
}
|
||||
|
||||
public void ContinueDialogue()
|
||||
{
|
||||
currentText++;
|
||||
if (currentText >= scriptToShow.dialogueList.Length)
|
||||
{
|
||||
EndDialogue();
|
||||
return;
|
||||
}
|
||||
DialogueScript.Dialogue currentDialogue = scriptToShow.dialogueList[currentText];
|
||||
SetDialogue(currentDialogue);
|
||||
}
|
||||
|
||||
public void EndDialogue()
|
||||
{
|
||||
dialogueActive = false;
|
||||
dialogueUI.SetActive(false);
|
||||
WaveManager.instance.player.isStalled = false;
|
||||
WaveManager.instance.bossInstance.isStalled = false;
|
||||
//GameManager.instance.SetPause(false);
|
||||
reisenAnimator.SetTrigger(switchToIdleTrigger);
|
||||
youmuAnimator.SetTrigger(switchToIdleTrigger);
|
||||
}
|
||||
|
||||
private void SetDialogue(DialogueScript.Dialogue textToShow)
|
||||
{
|
||||
reisenSpeechBubble.SetActive(false);
|
||||
youmuSpeechBubble.SetActive(false);
|
||||
bossSpeechBubble.gameObject.SetActive(false);
|
||||
switch (textToShow.character.thisCharacter) //everyone will hate this code but that's alright
|
||||
{
|
||||
case DialogueCharacter.Character.Reisen:
|
||||
reisenSpeechBubble.SetActive(true);
|
||||
reisenText.text = textToShow.text;
|
||||
youmuAnimator.SetTrigger(changeDialogueTrigger);
|
||||
reisenAnimator.SetTrigger(talkTrigger);
|
||||
break;
|
||||
case DialogueCharacter.Character.Youmu:
|
||||
youmuSpeechBubble.SetActive(true);
|
||||
youmuText.text = textToShow.text;
|
||||
youmuAnimator.SetTrigger(talkTrigger);
|
||||
reisenAnimator.SetTrigger(changeDialogueTrigger);
|
||||
break;
|
||||
case DialogueCharacter.Character.Enemy:
|
||||
bossSpeechBubble.gameObject.SetActive(true);
|
||||
bossText.text = textToShow.text;
|
||||
reisenAnimator.SetTrigger(changeDialogueTrigger);
|
||||
youmuAnimator.SetTrigger(changeDialogueTrigger);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (dialogueActive)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
ContinueDialogue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Dialogue/DialogueManager.cs.meta
Normal file
2
Assets/Scripts/Dialogue/DialogueManager.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 13ba117626f0a4a9fabe70178e0635be
|
||||
15
Assets/Scripts/Dialogue/DialogueScript.cs
Normal file
15
Assets/Scripts/Dialogue/DialogueScript.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "New Dialogue Script", menuName = "Dialogue/Script")]
|
||||
public class DialogueScript : ScriptableObject
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Dialogue
|
||||
{
|
||||
public DialogueCharacter character;
|
||||
public string text;
|
||||
public Sprite cutsceneImage; //only for cutscenes lol
|
||||
}
|
||||
public Dialogue[] dialogueList;
|
||||
public int nextScene;
|
||||
}
|
||||
2
Assets/Scripts/Dialogue/DialogueScript.cs.meta
Normal file
2
Assets/Scripts/Dialogue/DialogueScript.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 62aa0cb4b5a429c90801dae416f91cb6
|
||||
Loading…
Add table
Add a link
Reference in a new issue