diff --git a/client/player/Player.tscn b/client/player/Player.tscn index c35bf8f..77f1968 100644 --- a/client/player/Player.tscn +++ b/client/player/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=29 format=3 uid="uid://2lcnu3dy54lx"] +[gd_scene load_steps=30 format=3 uid="uid://2lcnu3dy54lx"] [ext_resource type="Script" path="res://player/Player.gd" id="1_8gebs"] [ext_resource type="PackedScene" uid="uid://c8j7t4yg7anb0" path="res://assets/female/Female.blend" id="2_8nah6"] @@ -16,24 +16,47 @@ [ext_resource type="PackedScene" uid="uid://bivxnxwi863o0" path="res://player/animation/AnimationComponent.tscn" id="10_bcaeg"] [ext_resource type="AnimationLibrary" uid="uid://d4n0puibh4hyt" path="res://assets/animations/human.blend" id="11_d0e6r"] [ext_resource type="AudioStream" uid="uid://dlqcgg8v3lvhm" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-00.wav" id="12_h5nrh"] -[ext_resource type="AudioStream" uid="uid://bgdodasvt7ier" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-01.wav" id="21_a8ikg"] [ext_resource type="AudioStream" uid="uid://bcn7rvvayhnib" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-02.wav" id="14_6dv65"] +[ext_resource type="PackedScene" uid="uid://b8xf4ltqyorjv" path="res://player/skills/SkillsComponent.tscn" id="14_6idcf"] [ext_resource type="AudioStream" uid="uid://bsc8b4ltoiflu" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-03.wav" id="15_1rjwu"] [ext_resource type="AudioStream" uid="uid://b5xq4cfmo02vw" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-04.wav" id="16_d8yn0"] [ext_resource type="AudioStream" uid="uid://cpldevudwvnkt" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-05.wav" id="17_74v1j"] +[ext_resource type="PackedScene" uid="uid://clnfp813k7lep" path="res://player/audio/AudioComponent.tscn" id="17_ovrf7"] [ext_resource type="AudioStream" uid="uid://biyotdu77a788" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-06.wav" id="18_qkget"] [ext_resource type="AudioStream" uid="uid://cdywep3dxm0y3" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-07.wav" id="19_vvmo0"] [ext_resource type="AudioStream" uid="uid://bp8pka7qhcetq" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-08.wav" id="20_srjtb"] -[ext_resource type="PackedScene" uid="uid://b8xf4ltqyorjv" path="res://player/skills/SkillsComponent.tscn" id="14_6idcf"] -[ext_resource type="PackedScene" uid="uid://clnfp813k7lep" path="res://player/audio/AudioComponent.tscn" id="17_ovrf7"] - - +[ext_resource type="AudioStream" uid="uid://bgdodasvt7ier" path="res://assets/audio/footsteps/Footsteps-Human-Dirt-01.wav" id="21_a8ikg"] [ext_resource type="PackedScene" uid="uid://sx4ein0bju6m" path="res://player/state/StateComponent.tscn" id="28_0i0of"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2f50n"] radius = 0.3 height = 1.6 +[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_4yj1k"] +random_pitch = 1.1 +random_volume_offset_db = 1.0 +streams_count = 10 +stream_0/stream = ExtResource("12_h5nrh") +stream_0/weight = 1.0 +stream_1/stream = ExtResource("21_a8ikg") +stream_1/weight = 1.0 +stream_2/stream = ExtResource("14_6dv65") +stream_2/weight = 1.0 +stream_3/stream = ExtResource("15_1rjwu") +stream_3/weight = 1.0 +stream_4/stream = ExtResource("16_d8yn0") +stream_4/weight = 1.0 +stream_5/stream = ExtResource("17_74v1j") +stream_5/weight = 1.0 +stream_6/stream = ExtResource("18_qkget") +stream_6/weight = 1.0 +stream_7/stream = ExtResource("19_vvmo0") +stream_7/weight = 1.0 +stream_8/stream = ExtResource("20_srjtb") +stream_8/weight = 1.0 +stream_9/stream = ExtResource("21_a8ikg") +stream_9/weight = 1.0 + [node name="Player" type="CharacterBody3D" groups=["player"]] collision_layer = 512 collision_mask = 769 @@ -88,7 +111,7 @@ radius = 2.0 [node name="Audio" parent="." node_paths=PackedStringArray("skeleton", "movement") instance=ExtResource("17_ovrf7")] skeleton = NodePath("../Model/Female/Armature/GeneralSkeleton") movement = NodePath("../Movement") -footsteps = Array[AudioStream]([ExtResource("12_h5nrh"), ExtResource("21_a8ikg"), ExtResource("14_6dv65"), ExtResource("15_1rjwu"), ExtResource("16_d8yn0"), ExtResource("17_74v1j"), ExtResource("18_qkget"), ExtResource("19_vvmo0"), ExtResource("20_srjtb"), ExtResource("21_a8ikg")]) +footsteps = SubResource("AudioStreamRandomizer_4yj1k") [node name="Health" parent="." instance=ExtResource("2_np5ag")] max_value = 100.0 diff --git a/client/player/audio/AudioComponent.gd b/client/player/audio/AudioComponent.gd index af9b800..873a472 100644 --- a/client/player/audio/AudioComponent.gd +++ b/client/player/audio/AudioComponent.gd @@ -1,9 +1,9 @@ class_name AudioComponent -extends Node +extends Node3D @export var skeleton: Skeleton3D @export var movement: MovementComponent -@export var footsteps: Array[AudioStream] +@export var footsteps: AudioStreamRandomizer @export var step_threshold := 0.1 const feet_names := ["LeftFoot", "RightFoot"] @@ -45,6 +45,5 @@ func _process(delta: float): play(foot.audio) func play(audio_player: AudioStreamPlayer3D): - audio_player.stream = footsteps[randi_range(0, footsteps.size()-1)] - audio_player.pitch_scale = randf_range(0.9, 1.1) + audio_player.stream = footsteps audio_player.play()