Add setting true/false audio background in war level

This commit is contained in:
VAILLANT Jeremy
2021-05-23 21:21:10 +02:00
parent cb1d8ed489
commit 7828b34c01
11 changed files with 190 additions and 92 deletions
-4
View File
@@ -15,7 +15,6 @@ onready var mscene = load("res://db/MScene.gd")
func _ready():
_load_translations()
_play_ambiant_sound()
_load_meshes()
func _process(_delta):
@@ -145,6 +144,3 @@ func _check_collider(space_state):
var node = result["collider"].get_parent()
if node != null:
_start_dissolve(node.name)
func _play_ambiant_sound():
$AmbiantSound.play()
+9 -4
View File
@@ -8,6 +8,7 @@ onready var last_btn = null
func _ready():
_display_hud_menu()
_play_ambiant_sound()
func _display_hud_menu():
var counter = 0
@@ -22,21 +23,20 @@ func _display_hud_menu():
# Back to main scene
func _on_TextureButton_pressed():
print("[levels#_on_TextureButton_pressed] quit to menu")
Global.goto_scene("res://scenes/main.tscn")
func _create_button_info(scene, counter, label_id):
var btn = null
if counter == 0:
print("[warCraft#_create_button_info] ["+String(counter)+"] use first")
btn = object_first.instance()
#print("[warCraft#_create_button_info] ["+String(counter)+"] use first")
elif counter == meshes.size() - 1:
btn = object_last.instance()
print("[warCraft#_create_button_info] ["+String(counter)+"] use last")
#print("[warCraft#_create_button_info] ["+String(counter)+"] use last")
else:
btn = object_std.instance()
print("[warCraft#_create_button_info] ["+String(counter)+"] use standar")
#print("[warCraft#_create_button_info] ["+String(counter)+"] use standar")
if label_id != null and label_id == scene.label_id():
last_btn.get_node("Label").set_text(last_btn.get_node("Label").text + " X")
@@ -45,3 +45,8 @@ func _create_button_info(scene, counter, label_id):
btn.get_node("Label").set_text(scene.label())
last_btn = btn
func _play_ambiant_sound():
if Global.get_setting_ambiant_sound():
$AmbiantSound.play()
$AmbiantSound.stream_paused = false
+2 -2
View File
@@ -271,7 +271,7 @@ cell_center_y = false
cell_center_z = false
baked_meshes = [ SubResource( 4 ) ]
data = {
"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 3, 65533, 0, 3, 65534, 0, 536870915, 65535, 0, -1610612733, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, 3, 65535, 1, 3, 0, 2, 3, 65531, 2, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 65533, -1610612733, 65532, 65533, 3, 65533, 65533, 3, 65534, 65533, 3, 65535, 65533, 3, 0, 65534, 3, 65531, 65534, 3, 65532, 65534, 3, 65533, 65534, 3, 65534, 65534, 3, 65535, 65534, 3, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, 3, 65533, 65535, 3, 65534, 65535, 3, 65535, 65535, 3 )
"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, -1073741821, 65533, 0, -536870909, 65534, 0, 3, 65535, 0, -1610612733, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, 3, 65535, 1, 3, 0, 2, 3, 65531, 2, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 65533, 3, 65532, 65533, 3, 65533, 65533, 3, 65534, 65533, 3, 65535, 65533, 3, 0, 65534, 3, 65531, 65534, 3, 65532, 65534, 3, 65533, 65534, 3, 65534, 65534, 3, 65535, 65534, 3, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, 3, 65533, 65535, 3, 65534, 65535, 3, 65535, 65535, 3 )
}
__meta__ = {
"_editor_clip_": 0,
@@ -747,7 +747,7 @@ shape = SubResource( 18 )
[node name="AmbiantSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 46 )
volume_db = -15.0
autoplay = true
stream_paused = true
[connection signal="pressed" from="Quit/TextureButton" to="." method="_on_TextureButton_pressed"]