-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTypingManager.gd
44 lines (38 loc) · 1.01 KB
/
TypingManager.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class_name TypingManager extends Node
@export var speaker_click : AudioStreamPlayer2D
@export var dialogueUI : Label3D
@export var dialogueSpeed : float
@export var incrementDelay : float
var elapsed = 0
var moving = false
var looping = false
func ShowText_ForDuration(activeText : String, showDuration : float):
looping = false
dialogueUI.visible_characters = 0
dialogueUI.text = activeText
dialogueUI.visible = true
looping = true
TickText()
await get_tree().create_timer(showDuration, false).timeout
looping = false
dialogueUI.visible = false
func ShowText_Forever(activeText : String):
looping = false
dialogueUI.visible_characters = 0
dialogueUI.text = activeText
dialogueUI.visible = true
looping = true
TickText()
func HideText():
looping = false
dialogueUI.visible = false
pass
func TickText():
while(looping):
dialogueUI.visible_characters += 1
speaker_click.play()
if (dialogueUI.visible_ratio >= 1):
looping = false
await get_tree().create_timer(incrementDelay, false).timeout
pass
pass