Add methods for sound ambiant & click object

This commit is contained in:
VAILLANT Jeremy
2021-05-23 15:10:20 +02:00
parent 8dfbc94887
commit cb1d8ed489
3 changed files with 19 additions and 17 deletions
+17 -13
View File
@@ -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()