Fixed commentary audio, removed print from door, cleanup

This commit is contained in:
Thomas Muller 2023-10-02 17:39:30 -04:00
parent 5e3675d5c9
commit 6337bdd9de
4 changed files with 23 additions and 21 deletions

View file

@ -1,5 +1,12 @@
extends StaticBody3D
@onready
var _audio = $AudioStreamPlayer
@onready
var _koob = $Koob
# Exports
@export_category('Commentary')
@ -7,21 +14,21 @@ extends StaticBody3D
@export
var sound: AudioStream = null :
get:
return $AudioStreamPlayer3D.stream
return $AudioStreamPlayer.stream
set(value):
$AudioStreamPlayer3D.stream = value
$AudioStreamPlayer.stream = value
@export_range(-80, 80, 1, "suffix:dB")
var volume = 0.0 :
get:
return $AudioStreamPlayer3D.volume_db
return $AudioStreamPlayer.volume_db
set(value):
$AudioStreamPlayer3D.volume_db = value
$AudioStreamPlayer.volume_db = value
@export_subgroup('Range')
@export_range(0, 100, 1, "suffix:m")
var capture_radius = 10.0
@export_range(0, 100, 1, "suffix:mad/s")
@export_range(0, 100, 1, "suffix:rad/s")
var low_speed = 1.0
@export_range(0, 100, 1, "suffix:rad/s")
var high_speed = 10.0
@ -35,14 +42,14 @@ var _original_color = null
func _ready():
$AudioStreamPlayer3D.stream = sound
$AudioStreamPlayer3D.volume_db = volume
$AudioStreamPlayer3D.finished.connect(_on_finished_playing)
_audio.stream = sound
_audio.volume_db = volume
_audio.finished.connect(_on_finished_playing)
# Make sure we have a unique material
# TODO: Why the fuck do I have to do this!?
# Isn't that the whole point of the "Make Unique"
$Koob.material = $Koob.material.duplicate()
_koob.material = _koob.material.duplicate()
func _process(delta):
@ -60,17 +67,17 @@ func _process(delta):
func interact(other):
if $AudioStreamPlayer3D.playing:
if _audio.playing:
return
_original_color = $Koob.material.albedo_color
_original_color = _koob.material.albedo_color
var random_color = Color(randf(), randf(), randf())
$Koob.material.albedo_color = random_color
_koob.material.albedo_color = random_color
$AudioStreamPlayer3D.play()
_audio.play()
func _on_finished_playing():
if _original_color:
$Koob.material.albedo_color = _original_color
_koob.material.albedo_color = _original_color

View file

@ -33,7 +33,7 @@ size = Vector3(1, 1.5, 1)
script = ExtResource("1_omu2m")
[node name="Koob" type="CSGMesh3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.816788, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.23446, 0)
mesh = SubResource("BoxMesh_sbsxh")
material = SubResource("StandardMaterial3D_8bjqg")
@ -51,5 +51,4 @@ active = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("BoxShape3D_k4wkk")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
attenuation_model = 2
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]

View file

@ -32,7 +32,6 @@ func _do_open():
_anim.play('open')
if autoclose_time != 0.0:
_timer.start(autoclose_time)
print('start ', autoclose_time)
else:
_anim.play_backwards('open')
@ -42,7 +41,6 @@ func _on_anim_finished(anim_name):
func _on_close_timer():
print('timer')
if _open:
_do_open()

View file

@ -32,14 +32,12 @@ shape = SubResource("ConcavePolygonShape3D_iw8bi")
[node name="Commentary" parent="." instance=ExtResource("2_3gk04")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.125, -0.25, 0.496153)
sound = ExtResource("3_57rk3")
volume = -20.0
capture_radius = 5.0
low_speed = 2.0
[node name="Commentary2" parent="." instance=ExtResource("2_3gk04")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.06073, -0.25, 3.2)
sound = ExtResource("4_qboc2")
volume = -20.0
[node name="Button" parent="." instance=ExtResource("5_57sxr")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -20.48, 2.15927, 5.76)