[gd_scene load_steps=22 format=3 uid="uid://xlt78xc1tmkl"]

[ext_resource type="Texture2D" uid="uid://cgwgmxwjgwbwr" path="res://assets/particles/splatter_2.png" id="1_5xu2x"]
[ext_resource type="Texture2D" uid="uid://bhoai6xv53tqm" path="res://assets/particles/splatter_1.png" id="2_bt63p"]
[ext_resource type="AudioStream" uid="uid://di0j2xhgfc78s" path="res://assets/sfx/grunk/splat1.wav" id="3_t00bd"]
[ext_resource type="AudioStream" uid="uid://d1w5gfmjj7tjk" path="res://assets/sfx/grunk/splat2.wav" id="4_2iem1"]
[ext_resource type="Script" uid="uid://c5o1d2shq2qig" path="res://src/world/game_sound/game_sound_emitter.gd" id="5_2iem1"]

[sub_resource type="Gradient" id="Gradient_5xu2x"]
offsets = PackedFloat32Array(0, 0.291304, 0.526087, 1)
colors = PackedColorArray(2, 2, 2, 1, 0, 0.101961, 0.301961, 1, 0, 0.0313726, 0.101961, 1, 0, 0, 0, 0)

[sub_resource type="GradientTexture1D" id="GradientTexture1D_bt63p"]
gradient = SubResource("Gradient_5xu2x")
use_hdr = true

[sub_resource type="Curve" id="Curve_y6klh"]
_data = [Vector2(0.148438, 0.19687), 0.0, 0.0, 0, 0, Vector2(0.339844, 1), 0.0, 0.0, 0, 0]
point_count = 2

[sub_resource type="CurveTexture" id="CurveTexture_t00bd"]
curve = SubResource("Curve_y6klh")

[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_5xu2x"]
lifetime_randomness = 0.57
emission_shape = 1
emission_sphere_radius = 1.0
angle_min = 1.07288e-05
angle_max = 360.0
direction = Vector3(0, 0, 0)
spread = 180.0
initial_velocity_min = 8.0
initial_velocity_max = 8.0
scale_curve = SubResource("CurveTexture_t00bd")
color_ramp = SubResource("GradientTexture1D_bt63p")

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bt63p"]
transparency = 1
vertex_color_use_as_albedo = true
albedo_texture = ExtResource("1_5xu2x")
texture_filter = 2
billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false

[sub_resource type="QuadMesh" id="QuadMesh_y6klh"]
material = SubResource("StandardMaterial3D_bt63p")
size = Vector2(0.5, 0.5)

[sub_resource type="Curve" id="Curve_bt63p"]
_limits = [0.0, 0.7, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.199219, 0.7), -0.414907, -0.414907, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3

[sub_resource type="CurveTexture" id="CurveTexture_2iem1"]
curve = SubResource("Curve_bt63p")

[sub_resource type="Curve" id="Curve_t00bd"]
_data = [Vector2(0, 0), 0.0, 1.334, 0, 0, Vector2(1, 1), -0.0498424, 0.0, 0, 0]
point_count = 2

[sub_resource type="CurveTexture" id="CurveTexture_72g1e"]
curve = SubResource("Curve_t00bd")

[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2iem1"]
lifetime_randomness = 0.55
emission_shape = 1
emission_sphere_radius = 0.9
angle_min = 1.07288e-05
angle_max = 360.0
direction = Vector3(0, 1, 0)
spread = 0.0
initial_velocity_max = 0.05
gravity = Vector3(0, -0.3, 0)
scale_curve = SubResource("CurveTexture_72g1e")
color = Color(0.9, 0.983333, 1, 1)
alpha_curve = SubResource("CurveTexture_2iem1")

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ckw5w"]
transparency = 1
vertex_color_use_as_albedo = true
albedo_texture = ExtResource("2_bt63p")
texture_filter = 2
billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false

[sub_resource type="QuadMesh" id="QuadMesh_6adkd"]
material = SubResource("StandardMaterial3D_ckw5w")
size = Vector2(2, 2)

[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_6adkd"]
playback_mode = 1
random_pitch = 1.2
streams_count = 2
stream_0/stream = ExtResource("3_t00bd")
stream_1/stream = ExtResource("4_2iem1")

[sub_resource type="SphereShape3D" id="SphereShape3D_6adkd"]
radius = 2.0

[node name="GrunkSplatter" type="GPUParticles3D"]
sorting_offset = 9.0
emitting = false
amount = 64
lifetime = 0.3
one_shot = true
explosiveness = 0.45
process_material = SubResource("ParticleProcessMaterial_5xu2x")
draw_pass_1 = SubResource("QuadMesh_y6klh")

[node name="SubSplatter" type="GPUParticles3D" parent="."]
sorting_offset = 9.0
emitting = false
amount = 4
lifetime = 0.3
one_shot = true
explosiveness = 0.63
interpolate = false
fract_delta = false
process_material = SubResource("ParticleProcessMaterial_2iem1")
draw_pass_1 = SubResource("QuadMesh_6adkd")

[node name="FreeTimer" type="Timer" parent="."]
wait_time = 3.0
one_shot = true
autostart = true

[node name="SplatterSFX" type="AudioStreamPlayer3D" parent="."]
stream = SubResource("AudioStreamRandomizer_6adkd")
volume_db = -10.0
unit_size = 6.0
autoplay = true
bus = &"SFX"

[node name="SplatterSoundEmitter" type="Area3D" parent="."]
collision_layer = 0
collision_mask = 16
script = ExtResource("5_2iem1")
metadata/_custom_type_script = "uid://c5o1d2shq2qig"

[node name="CollisionShape3D" type="CollisionShape3D" parent="SplatterSoundEmitter"]
shape = SubResource("SphereShape3D_6adkd")

[connection signal="ready" from="." to="SplatterSFX" method="play"]
[connection signal="ready" from="." to="SplatterSoundEmitter" method="emit_sound_here"]
[connection signal="ready" from="." to="." method="set_emitting" binds= [true]]
[connection signal="ready" from="." to="SubSplatter" method="set_emitting" binds= [true]]
[connection signal="timeout" from="FreeTimer" to="." method="queue_free"]
