mirror of
https://github.com/thecatontheceiling/buckshotroulette-decomp.git
synced 2024-11-25 15:07:21 +00:00
41 lines
981 B
GDScript
41 lines
981 B
GDScript
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
|