added audio subtitle system and menus and more

This commit is contained in:
2024-01-23 23:58:30 +01:00
parent 7d77925b97
commit e7973d6086
32 changed files with 479 additions and 221 deletions

View File

@@ -0,0 +1,21 @@
extends AudioStreamPlayer3D
@export var voice_lines: Array[VoiceLine]
@onready var textbox: RichTextLabel = $CanvasLayer/PanelContainer/RichTextLabel
var played: bool
func _on_area_3d_body_entered(body: Node3D) -> void:
if !played && body is Player:
start_audio_sequence()
played = true
func start_audio_sequence():
$CanvasLayer/PanelContainer.show()
for line in voice_lines:
textbox.text = line.text
stream = line.audio
play()
await finished
$CanvasLayer/PanelContainer.hide()

View File

@@ -0,0 +1,12 @@
extends Node
var close_request_window: ConfirmationDialog
func _ready() -> void:
close_request_window = preload("res://scenes/close_game_confirmation.tscn").instantiate()
add_child(close_request_window)
func _notification(what: int) -> void:
if what == NOTIFICATION_WM_CLOSE_REQUEST:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
close_request_window.popup()

View File

@@ -0,0 +1,7 @@
extends ConfirmationDialog
func _on_confirmed() -> void:
pass # Replace with function body.
func _on_canceled() -> void:
get_tree().quit()

View File

@@ -24,6 +24,7 @@ func _physics_process(_delta):
collider.global_position = player.goal.global_position
elif player.raycast.get_collider() is RigidBody3D:
collider = player.raycast.get_collider()
collider.lock_rotation = true
if Input.is_action_pressed("gravity_push") || Input.is_action_just_pressed("gravity_push"):
player.spring_arm.spring_length += .5
if Input.is_action_pressed("gravity_pull") || Input.is_action_just_pressed("gravity_pull"):
@@ -31,5 +32,7 @@ func _physics_process(_delta):
player.spring_arm.spring_length = clamp(player.spring_arm.spring_length,2,spring_length_cap)
else:
gravity_particles.visible = false
if collider:
collider.lock_rotation = false
collider = null

View File

@@ -0,0 +1,3 @@
extends Control

View File

@@ -51,7 +51,7 @@ func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion && Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
rotate_y(-event.relative.x * camera_senitivity * 0.0025)
camera.rotate_x(-event.relative.y * camera_senitivity * 0.0015)
camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, -40, 80)
camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, -80, 80)
if event.is_action_pressed("pause"):
capture(false)
if event.is_action_pressed("mouse_capture"):

View File

@@ -0,0 +1,5 @@
extends Resource
class_name VoiceLine
@export var audio: AudioStreamOggVorbis
@export_multiline var text: String