generated from krampus/template-godot4
Game-global SFX
This commit is contained in:
parent
af5cd75603
commit
5cce252627
|
@ -6,6 +6,7 @@ class_name Game extends Node
|
||||||
var _loading_resources := {}
|
var _loading_resources := {}
|
||||||
|
|
||||||
@onready var viewport: GameViewportContainer = %ViewportContainer
|
@onready var viewport: GameViewportContainer = %ViewportContainer
|
||||||
|
@onready var sfx: GameSFX = %SFX
|
||||||
|
|
||||||
@onready var content: Node = %Content
|
@onready var content: Node = %Content
|
||||||
@onready var loader_transition: AnimationPlayer = %LoaderTransition
|
@onready var loader_transition: AnimationPlayer = %LoaderTransition
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://cefit4bc8akbb"]
|
[gd_scene load_steps=13 format=3 uid="uid://cefit4bc8akbb"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/game/game.gd" id="1_4qa87"]
|
[ext_resource type="Script" path="res://src/game/game.gd" id="1_4qa87"]
|
||||||
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="2_y3adf"]
|
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="2_y3adf"]
|
||||||
|
@ -6,6 +6,8 @@
|
||||||
[ext_resource type="Script" path="res://src/ui/game_viewport_container.gd" id="3_rmm5i"]
|
[ext_resource type="Script" path="res://src/ui/game_viewport_container.gd" id="3_rmm5i"]
|
||||||
[ext_resource type="Script" path="res://src/game/game_viewport.gd" id="5_v2qv5"]
|
[ext_resource type="Script" path="res://src/game/game_viewport.gd" id="5_v2qv5"]
|
||||||
[ext_resource type="Script" path="res://src/util/debug_version_info.gd" id="6_42bd1"]
|
[ext_resource type="Script" path="res://src/util/debug_version_info.gd" id="6_42bd1"]
|
||||||
|
[ext_resource type="Script" path="res://src/game/sfx.gd" id="7_xpf8p"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://8uynlpios7u1" path="res://assets/sound/sfx/ui/ecofuture2.wav" id="8_ab8py"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_c3dlb"]
|
[sub_resource type="Animation" id="Animation_c3dlb"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
|
@ -238,3 +240,12 @@ script = ExtResource("5_v2qv5")
|
||||||
[node name="Content" type="Node" parent="RootControl/Rumbler/ViewportContainer/Viewport"]
|
[node name="Content" type="Node" parent="RootControl/Rumbler/ViewportContainer/Viewport"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
|
|
||||||
|
[node name="SFX" type="Node" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
script = ExtResource("7_xpf8p")
|
||||||
|
|
||||||
|
[node name="Chime" type="AudioStreamPlayer" parent="SFX"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
stream = ExtResource("8_ab8py")
|
||||||
|
bus = &"SFX"
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
class_name GameSFX extends Node
|
||||||
|
## Container & accessor for game-global SFX
|
||||||
|
|
||||||
|
@onready var chime: AudioStreamPlayer = %Chime
|
|
@ -14,13 +14,13 @@ const SCENE := "res://src/ui/menus/title_screen/title_screen.tscn"
|
||||||
@onready var state_machine: AnimationTree = $Menu/MenuStateMachine
|
@onready var state_machine: AnimationTree = $Menu/MenuStateMachine
|
||||||
@onready var menu_state: AnimationNodeStateMachinePlayback = state_machine["parameters/playback"]
|
@onready var menu_state: AnimationNodeStateMachinePlayback = state_machine["parameters/playback"]
|
||||||
|
|
||||||
@onready var confirm_sfx: AudioStreamPlayer = %ConfirmSFX
|
|
||||||
|
|
||||||
@onready var idle_timer: Timer = %IdleTimer
|
@onready var idle_timer: Timer = %IdleTimer
|
||||||
|
|
||||||
|
@onready var game: Game = get_tree().get_first_node_in_group(Game.group)
|
||||||
|
|
||||||
|
|
||||||
func play_chime() -> void:
|
func play_chime() -> void:
|
||||||
confirm_sfx.play()
|
game.sfx.chime.play()
|
||||||
|
|
||||||
|
|
||||||
func start_title_crawl() -> void:
|
func start_title_crawl() -> void:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=87 format=3 uid="uid://7fsgocmdas7i"]
|
[gd_scene load_steps=86 format=3 uid="uid://7fsgocmdas7i"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/ui/menus/title_screen/title_screen.gd" id="1_2qtlb"]
|
[ext_resource type="Script" path="res://src/ui/menus/title_screen/title_screen.gd" id="1_2qtlb"]
|
||||||
[ext_resource type="Texture2D" uid="uid://880x5n8j3b5l" path="res://assets/logo/title.png" id="1_pm82i"]
|
[ext_resource type="Texture2D" uid="uid://880x5n8j3b5l" path="res://assets/logo/title.png" id="1_pm82i"]
|
||||||
|
@ -6,7 +6,6 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://clesl8lljs6of" path="res://assets/logo/subtitle.png" id="2_y0ulk"]
|
[ext_resource type="Texture2D" uid="uid://clesl8lljs6of" path="res://assets/logo/subtitle.png" id="2_y0ulk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ccx2u5oli6men" path="res://src/ui/menus/title_screen/deathmatch_setup/deathmatch_setup.tscn" id="3_bo4ty"]
|
[ext_resource type="PackedScene" uid="uid://ccx2u5oli6men" path="res://src/ui/menus/title_screen/deathmatch_setup/deathmatch_setup.tscn" id="3_bo4ty"]
|
||||||
[ext_resource type="Material" uid="uid://dpsmjlhjpc7vs" path="res://assets/materials/basic_ball_material.tres" id="5_5q83g"]
|
[ext_resource type="Material" uid="uid://dpsmjlhjpc7vs" path="res://assets/materials/basic_ball_material.tres" id="5_5q83g"]
|
||||||
[ext_resource type="AudioStream" uid="uid://8uynlpios7u1" path="res://assets/sound/sfx/ui/ecofuture2.wav" id="5_fg1a4"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cqu315hviu72n" path="res://src/ui/menus/title_screen/title_crawl.tscn" id="7_r26eu"]
|
[ext_resource type="PackedScene" uid="uid://cqu315hviu72n" path="res://src/ui/menus/title_screen/title_crawl.tscn" id="7_r26eu"]
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_ardux"]
|
[sub_resource type="Environment" id="Environment_ardux"]
|
||||||
|
@ -250,25 +249,16 @@ tracks/1/path = NodePath("../../..")
|
||||||
tracks/1/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
"times": PackedFloat32Array(0.6),
|
"times": PackedFloat32Array(0, 0.6),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"values": [{
|
"values": [{
|
||||||
"args": [],
|
"args": [],
|
||||||
|
"method": &"play_chime"
|
||||||
|
}, {
|
||||||
|
"args": [],
|
||||||
"method": &"_on_quit"
|
"method": &"_on_quit"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/path = NodePath("%ConfirmSFX:playing")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [true]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_cgw58"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_cgw58"]
|
||||||
_data = {
|
_data = {
|
||||||
|
@ -1490,7 +1480,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="PressStart" type="Label" parent="Menu"]
|
[node name="PressStart" type="Label" parent="Menu"]
|
||||||
modulate = Color(1, 1, 1, 0.0413553)
|
modulate = Color(1, 1, 1, 0.0024811)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -1703,11 +1693,6 @@ libraries = {
|
||||||
}
|
}
|
||||||
autoplay = "press_start_fade_in"
|
autoplay = "press_start_fade_in"
|
||||||
|
|
||||||
[node name="ConfirmSFX" type="AudioStreamPlayer" parent="."]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
stream = ExtResource("5_fg1a4")
|
|
||||||
bus = &"SFX"
|
|
||||||
|
|
||||||
[node name="SettingsContainer" type="MarginContainer" parent="."]
|
[node name="SettingsContainer" type="MarginContainer" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
Loading…
Reference in New Issue