]> git.lizzy.rs Git - SuperMouseAdventure.git/blobdiff - 2DGame/Assets/Scripts/Dialogue/Dialogue.cs
Dialogue-System v0.6
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Dialogue / Dialogue.cs
index b0134199d9fe28c4144cfc868a70ed8d38d0a57e..1653141318e3b5067ca803262788c5eae165005c 100644 (file)
@@ -1,3 +1,4 @@
+using System;\r
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
@@ -21,6 +22,8 @@ public class Dialogue : MonoBehaviour
 
     public float typingSpeed;
 
+    public bool skip;
+
     void Start()
     {
         dialogueBox.SetActive(false);
@@ -35,6 +38,18 @@ public class Dialogue : MonoBehaviour
         {
             continueButton.SetActive(true);
         }
+
+        if (dialogueText.text != sentences[index])
+        {
+            if (Input.GetKeyDown(KeyCode.Return))
+            {
+                skip = true;
+            }
+            else
+            {
+                skip = false;
+            }
+        }
     }
 
     public IEnumerator Type()
@@ -49,10 +64,16 @@ public class Dialogue : MonoBehaviour
         }
     }
 
+    public void Skip()
+    {
+        dialogueText.text = sentences[index];
+    }
+
     public void NextSentence()
     {
         FindObjectOfType<AudioManager>().Play("click");
         continueButton.SetActive(false);
+        skip= false;
 
         if (index < sentences.Length - 1)
         {