Commit f3042069 authored by Fuchsi*'s avatar Fuchsi*

automatically advance text

parent 229edc6d
......@@ -14,6 +14,7 @@ public class TextDisplay : MonoBehaviour {
AudioSource auds;
float showSkip = 0;
float autoSkip = 0;
void Awake() {
text = GetComponentInChildren<TextMeshProUGUI>();
......@@ -25,7 +26,7 @@ public class TextDisplay : MonoBehaviour {
}
private void Update() {
if (skip.activeSelf && (Input.GetKeyDown("e") || Input.GetMouseButtonDown(0))) {
if (skip.activeSelf && (Input.GetKeyDown("e") || Input.GetMouseButtonDown(0) || Time.time > autoSkip)) {
NextLine();
}
if (panel.activeSelf && showSkip < Time.time) {
......@@ -51,6 +52,7 @@ public class TextDisplay : MonoBehaviour {
panel.SetActive(true);
skip.SetActive(false);
showSkip = Time.time + 1f;
autoSkip = Time.time + VAlines[0].length + .5f;
lines = lines.Skip(1).ToArray();
VAlines = VAlines.Skip(1).ToArray();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment