Add methods for sound ambiant & click object
This commit is contained in:
+17
-13
@@ -15,6 +15,7 @@ onready var mscene = load("res://db/MScene.gd")
|
||||
|
||||
func _ready():
|
||||
_load_translations()
|
||||
_play_ambiant_sound()
|
||||
_load_meshes()
|
||||
|
||||
func _process(_delta):
|
||||
@@ -106,6 +107,8 @@ func _gyroscope_changed_up(gyroscope):
|
||||
func _start_dissolve(key):
|
||||
if meshes[key].lock() == false:
|
||||
meshes[key].set_lock(true)
|
||||
$ObjectFind.stream = meshes[key].audio_sound()
|
||||
$ObjectFind.play()
|
||||
|
||||
## PRIVATE
|
||||
func _load_translations():
|
||||
@@ -119,15 +122,10 @@ func _load_meshes():
|
||||
|
||||
if scene_detail.key() != null:
|
||||
meshes[scene_detail.key()] = scene_detail
|
||||
# _display_label(scene_detail)
|
||||
|
||||
for key in meshes:
|
||||
meshes[key].search_keys()
|
||||
"""
|
||||
func _display_label(scene):
|
||||
print("[meshes#key] : "+scene.label())
|
||||
$ListObjects/ListContainer/TextureButton.set_text(scene.label())
|
||||
"""
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||
var camera = $"Main Camera"
|
||||
@@ -137,10 +135,16 @@ func _input(event):
|
||||
func _physics_process(_delta):
|
||||
var space_state = get_world().direct_space_state
|
||||
if from != null and to != null:
|
||||
var result = space_state.intersect_ray(from, to, [], 1, false, true)
|
||||
from = null
|
||||
to = null
|
||||
if result.has("collider"):
|
||||
var node = result["collider"].get_parent()
|
||||
if node != null:
|
||||
_start_dissolve(node.name)
|
||||
_check_collider(space_state)
|
||||
|
||||
func _check_collider(space_state):
|
||||
var result = space_state.intersect_ray(from, to, [], 1, false, true)
|
||||
from = null
|
||||
to = null
|
||||
if result.has("collider"):
|
||||
var node = result["collider"].get_parent()
|
||||
if node != null:
|
||||
_start_dissolve(node.name)
|
||||
|
||||
func _play_ambiant_sound():
|
||||
$AmbiantSound.play()
|
||||
|
||||
@@ -8,7 +8,6 @@ onready var last_btn = null
|
||||
|
||||
func _ready():
|
||||
_display_hud_menu()
|
||||
_play_ambiant_sound()
|
||||
|
||||
func _display_hud_menu():
|
||||
var counter = 0
|
||||
@@ -21,9 +20,6 @@ func _display_hud_menu():
|
||||
label_id = scene.label_id()
|
||||
counter = +1
|
||||
|
||||
func _play_ambiant_sound():
|
||||
$AmbiantSound.play()
|
||||
|
||||
# Back to main scene
|
||||
func _on_TextureButton_pressed():
|
||||
print("[levels#_on_TextureButton_pressed] quit to menu")
|
||||
|
||||
@@ -742,6 +742,8 @@ shape = SubResource( 18 )
|
||||
|
||||
[node name="Quit" parent="." instance=ExtResource( 45 )]
|
||||
|
||||
[node name="ObjectFind" type="AudioStreamPlayer" parent="."]
|
||||
|
||||
[node name="AmbiantSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 46 )
|
||||
volume_db = -15.0
|
||||
|
||||
Reference in New Issue
Block a user