added audio subtitle system and menus and more
This commit is contained in:
21
scripts/audio_subtitle_system.gd
Normal file
21
scripts/audio_subtitle_system.gd
Normal 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()
|
12
scripts/autoloads/window_manager.gd
Normal file
12
scripts/autoloads/window_manager.gd
Normal 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()
|
7
scripts/close_game_confirmation.gd
Normal file
7
scripts/close_game_confirmation.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends ConfirmationDialog
|
||||
|
||||
func _on_confirmed() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
func _on_canceled() -> void:
|
||||
get_tree().quit()
|
@@ -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
|
||||
|
||||
|
3
scripts/menus/pause_menu.gd
Normal file
3
scripts/menus/pause_menu.gd
Normal file
@@ -0,0 +1,3 @@
|
||||
extends Control
|
||||
|
||||
|
@@ -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"):
|
||||
|
5
scripts/voiceline_resource.gd
Normal file
5
scripts/voiceline_resource.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Resource
|
||||
class_name VoiceLine
|
||||
|
||||
@export var audio: AudioStreamOggVorbis
|
||||
@export_multiline var text: String
|
Reference in New Issue
Block a user