forked from unfa/liblast
Added bullet hit sounds and implemented auto play in SoundPlayer.
parent
5cc997b5b7
commit
8052ee8b3d
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=26 format=2]
|
||||
[gd_scene load_steps=27 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Effects/CircleHard.svg" type="Texture" id=1]
|
||||
[ext_resource path="res://Assets/Effects/CircleSoft.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://Assets/Effects/FreeTimer.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Audio/SoundPlayer.tscn" type="PackedScene" id=4]
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "Effect"
|
||||
|
@ -237,4 +238,8 @@ script = ExtResource( 3 )
|
|||
__meta__ = {
|
||||
"_editor_description_": "Time to delete this scene."
|
||||
}
|
||||
|
||||
[node name="SoundPlayer" parent="." instance=ExtResource( 4 )]
|
||||
SoundClip = "res://Assets/SFX/Weapons-BulletHitWall-01.wav"
|
||||
AutoPlay = true
|
||||
[connection signal="timeout" from="FreeTimer" to="FreeTimer" method="_on_FreeTimer_timeout"]
|
||||
|
|
|
@ -7,6 +7,7 @@ const SFX_dir = "res://Assets/SFX/" # all sound clips must reside somewhere in t
|
|||
onready var player = $AudioStreamPlayer3D # playback backend
|
||||
|
||||
export(String, FILE, "*-01.wav") var SoundClip = SFX_dir + "Test-01.wav"
|
||||
export(bool) var AutoPlay = false
|
||||
export(float) var MinimumRandomDistance = 0.35 # gives optimal playback repetition for sound clip groups of different sizes.
|
||||
export(bool) var PlayUntilEnd = false # determines if the play() function is allowed to sop a previously started sound
|
||||
export(float) var MinDelay = 0 # determines how many seconds must pass before the sound can be triggered again
|
||||
|
@ -46,6 +47,9 @@ func _ready():
|
|||
|
||||
print ("Clips: ", len(clips))
|
||||
print ("min_distance: ", min_distance)
|
||||
|
||||
if AutoPlay:
|
||||
play()
|
||||
|
||||
func pick_random():
|
||||
return randi() % len(clips)
|
||||
|
|
Loading…
Reference in New Issue