-
Notifications
You must be signed in to change notification settings - Fork 1
/
DialogueManager_Ending.gd
40 lines (34 loc) · 981 Bytes
/
DialogueManager_Ending.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
class_name DialogueEnding extends Node
@export var speaker_click : AudioStreamPlayer2D
@export var soundArray_clicks : Array[AudioStream]
@export var dialogueUI : Label
@export var dialogueSpeed : float
@export var incrementDelay : float
var elapsed = 0
var moving = false
var looping = false
func _ready():
speaker_click.stream = soundArray_clicks[0]
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
var overriding = false
func TickText():
while(looping):
dialogueUI.visible_characters += 1
if (!overriding): speaker_click.pitch_scale = randf_range(.8, 1)
else: speaker_click.pitch_scale = randf_range(.2, .4)
speaker_click.play()
if (dialogueUI.visible_ratio >= 1):
looping = false
await get_tree().create_timer(incrementDelay, false).timeout
pass
pass