Added soul collection sound
This commit is contained in:
parent
d081686275
commit
2b7c1028cc
@ -8,7 +8,7 @@ var attractor: GPUParticlesAttractor3D
|
||||
var light: Light3D
|
||||
var sprite: Sprite3D
|
||||
var area: Area3D
|
||||
|
||||
var sound: AudioStreamPlayer3D
|
||||
var collected_by: Player
|
||||
|
||||
func _ready():
|
||||
@ -18,6 +18,7 @@ func _ready():
|
||||
sprite = %Sprite
|
||||
area = %Area
|
||||
attractor = %Attractor
|
||||
sound = %Sound
|
||||
|
||||
func _process(delta):
|
||||
if !collected_by:
|
||||
@ -26,18 +27,21 @@ func _process(delta):
|
||||
global_position = Math.damp(global_position, Global.player.global_position + Vector3.UP, 1.0 * delta)
|
||||
|
||||
func on_body_entered(body: Node3D):
|
||||
if body is Player:
|
||||
collected_by = body
|
||||
attractor.visible = false
|
||||
area.set_deferred("monitoring", false)
|
||||
particles.process_material.attractor_interaction_enabled = true
|
||||
|
||||
var tween = get_tree().create_tween()
|
||||
tween.parallel().tween_property(particles, "amount_ratio", 0, tween_duration)
|
||||
# tween.parallel().tween_property(trails, "amount_ratio", 0, tween_duration)
|
||||
tween.parallel().tween_property(light, "light_energy", 0, tween_duration)
|
||||
tween.parallel().tween_property(sprite, "scale", Vector3.ZERO, tween_duration)
|
||||
tween.parallel().tween_property(sprite, "material_override:albedo_color", Color(0, 0, 0, 0), tween_duration)
|
||||
await tween.finished
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
queue_free()
|
||||
if not body is Player:
|
||||
return
|
||||
|
||||
collected_by = body
|
||||
attractor.visible = false
|
||||
area.set_deferred("monitoring", false)
|
||||
particles.process_material.attractor_interaction_enabled = true
|
||||
sound.play()
|
||||
|
||||
var tween = get_tree().create_tween()
|
||||
tween.parallel().tween_property(particles, "amount_ratio", 0, tween_duration)
|
||||
# tween.parallel().tween_property(trails, "amount_ratio", 0, tween_duration)
|
||||
tween.parallel().tween_property(light, "light_energy", 0, tween_duration)
|
||||
tween.parallel().tween_property(sprite, "scale", Vector3.ZERO, tween_duration)
|
||||
tween.parallel().tween_property(sprite, "material_override:albedo_color", Color(0, 0, 0, 0), tween_duration)
|
||||
await tween.finished
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
queue_free()
|
||||
|
@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://dl4vcp04t8iyr"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://dl4vcp04t8iyr"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cdoxs0s8xh1b3" path="res://particle/FadeOut.tres" id="1_dd0n2"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3wx3cgn8x62m" path="res://assets/particles/particles-single.png" id="1_hhudy"]
|
||||
[ext_resource type="Script" path="res://item/soul/Soul.gd" id="1_mm7cb"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfkwtmj6tc3wa" path="res://item/soul/color_ramp.tres" id="3_ibw0j"]
|
||||
[ext_resource type="AudioStream" uid="uid://l6d76tn8ys5n" path="res://assets/audio/effects/Games-Video-Event-Collect-Item.wav" id="5_cxtbb"]
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_uyeuh"]
|
||||
lifetime_randomness = 0.15
|
||||
@ -123,4 +124,10 @@ monitorable = false
|
||||
[node name="SphereShape" type="CollisionShape3D" parent="Area"]
|
||||
shape = SubResource("SphereShape3D_rytrf")
|
||||
|
||||
[node name="Sound" type="AudioStreamPlayer3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("5_cxtbb")
|
||||
max_distance = 20.0
|
||||
bus = &"Effects"
|
||||
|
||||
[connection signal="body_entered" from="Area" to="." method="on_body_entered"]
|
||||
|
Loading…
Reference in New Issue
Block a user