Clean up project, create Singleton
This commit is contained in:
@@ -5,8 +5,6 @@ namespace Scampz.GameJam
|
||||
[System.Serializable]
|
||||
public class Dialogue
|
||||
{
|
||||
public string name;
|
||||
|
||||
[TextArea(3, 10)]
|
||||
public string[] sentences;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ namespace Scampz.GameJam
|
||||
public class DialogueManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI nameText;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI dialogueText;
|
||||
private TextMeshProUGUI dialogueTextGUI;
|
||||
public float TextSpeed = 0.1f;
|
||||
|
||||
public static DialogueManager Instance { get; private set; }
|
||||
@@ -31,8 +29,6 @@ namespace Scampz.GameJam
|
||||
|
||||
public void StartDialogue(Dialogue dialogue)
|
||||
{
|
||||
nameText.text = dialogue.name;
|
||||
|
||||
sentences.Clear();
|
||||
foreach (var sentence in dialogue.sentences)
|
||||
sentences.Enqueue(sentence);
|
||||
@@ -53,10 +49,10 @@ namespace Scampz.GameJam
|
||||
private IEnumerator TypeSentence(string sentence)
|
||||
{
|
||||
|
||||
dialogueText.text = string.Empty;
|
||||
dialogueTextGUI.text = string.Empty;
|
||||
foreach (var letter in sentence.ToCharArray())
|
||||
{
|
||||
dialogueText.text += letter;
|
||||
dialogueTextGUI.text += letter;
|
||||
yield return null;
|
||||
yield return new WaitForSecondsRealtime(TextSpeed);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
public static string TitleScreenScene => "TitleScreen";
|
||||
|
||||
public static string BaseScene => "BaseScene";
|
||||
public static string Singleton => "Singleton";
|
||||
|
||||
public static string WorldMap => "WorldMap";
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class BaseSceneManager : MonoBehaviour
|
||||
public class SingletonManager : MonoBehaviour
|
||||
{
|
||||
void Start()
|
||||
{
|
||||
@@ -10,7 +10,7 @@ namespace Scampz.GameJam
|
||||
{
|
||||
if (Input.GetButtonDown(InputOptions.Submit))
|
||||
{
|
||||
GameManager.Instance.LoadScene(SceneNames.BaseScene, LoadSceneMode.Single);
|
||||
GameManager.Instance.LoadScene(SceneNames.Singleton, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user