add unit movement sounds
This commit is contained in:
parent
a080e96bb2
commit
737e1c7530
BIN
assets/audio/units/ant_move.wav
(Stored with Git LFS)
Normal file
BIN
assets/audio/units/ant_move.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
24
assets/audio/units/ant_move.wav.import
Normal file
24
assets/audio/units/ant_move.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://ds7c5gkf1mssj"
|
||||
path="res://.godot/imported/ant_move.wav-0265f62399d19f9a85ce5021aac88cdb.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/units/ant_move.wav"
|
||||
dest_files=["res://.godot/imported/ant_move.wav-0265f62399d19f9a85ce5021aac88cdb.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
||||
BIN
assets/audio/units/aphid_move.wav
(Stored with Git LFS)
Normal file
BIN
assets/audio/units/aphid_move.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
24
assets/audio/units/aphid_move.wav.import
Normal file
24
assets/audio/units/aphid_move.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://bqt1xdorarhoi"
|
||||
path="res://.godot/imported/aphid_move.wav-86075f01c7a2eff714e46b3c0d0d022d.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/units/aphid_move.wav"
|
||||
dest_files=["res://.godot/imported/aphid_move.wav-86075f01c7a2eff714e46b3c0d0d022d.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=2
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
||||
BIN
assets/audio/units/bug_move_1.wav
(Stored with Git LFS)
Normal file
BIN
assets/audio/units/bug_move_1.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
24
assets/audio/units/bug_move_1.wav.import
Normal file
24
assets/audio/units/bug_move_1.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://cqqq55wcilpwv"
|
||||
path="res://.godot/imported/bug_move_1.wav-ca16a49a43f111816ed4d6c7eda91953.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/units/bug_move_1.wav"
|
||||
dest_files=["res://.godot/imported/bug_move_1.wav-ca16a49a43f111816ed4d6c7eda91953.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
||||
BIN
assets/audio/units/bug_move_2.wav
(Stored with Git LFS)
Normal file
BIN
assets/audio/units/bug_move_2.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
24
assets/audio/units/bug_move_2.wav.import
Normal file
24
assets/audio/units/bug_move_2.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://d1cwg6l7mpw7h"
|
||||
path="res://.godot/imported/bug_move_2.wav-ebcaed7cbf63144f44a996b003d6502e.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/units/bug_move_2.wav"
|
||||
dest_files=["res://.godot/imported/bug_move_2.wav-ebcaed7cbf63144f44a996b003d6502e.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
||||
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://lbs0vilymbum"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://lbs0vilymbum"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cidd3q2tet7ku" path="res://scenes/units/abstract/controlled_unit.tscn" id="1_66kao"]
|
||||
[ext_resource type="Script" path="res://scripts/units/abstract/controlled_ant_unit.gd" id="2_77pj2"]
|
||||
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="2_e21vo"]
|
||||
[ext_resource type="AudioStream" uid="uid://ds7c5gkf1mssj" path="res://assets/audio/units/ant_move.wav" id="4_80pw8"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_jem3o"]
|
||||
animation = &"idle"
|
||||
@ -81,4 +82,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.65, 0)
|
||||
[node name="SelectionIndicator" parent="." index="7"]
|
||||
transform = Transform3D(0.772715, 0, 0, 0, 0.772715, 0, 0, 0, 0.772715, 0, 0, 0)
|
||||
|
||||
[node name="MoveSoundPlayer" parent="." index="10"]
|
||||
stream = ExtResource("4_80pw8")
|
||||
|
||||
[editable path="AntModel"]
|
||||
|
||||
@ -46,4 +46,10 @@ visible = false
|
||||
mesh = SubResource("BoxMesh_hvf81")
|
||||
|
||||
[node name="SoundEffectsPlayer" type="AudioStreamPlayer3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0)
|
||||
script = ExtResource("3_wl62h")
|
||||
|
||||
[node name="MoveSoundPlayer" type="AudioStreamPlayer3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0)
|
||||
attenuation_model = 1
|
||||
attenuation_filter_db = 0.0
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bw8cabkva3k4f"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bw8cabkva3k4f"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c70vx0utm5knp" path="res://scenes/units/abstract/unit.tscn" id="1_ghhpv"]
|
||||
[ext_resource type="Script" path="res://scripts/units/aphid.gd" id="2_c6sy4"]
|
||||
[ext_resource type="PackedScene" uid="uid://ch02ae8fj2lhh" path="res://assets/models/aphid.glb" id="2_vtmi4"]
|
||||
[ext_resource type="Material" uid="uid://f5ibq3dhugoo" path="res://resources/materials/aphid_mat.tres" id="3_b828p"]
|
||||
[ext_resource type="AudioStream" uid="uid://bqt1xdorarhoi" path="res://assets/audio/units/aphid_move.wav" id="5_f4mon"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_f1f0e"]
|
||||
animation = &"idle"
|
||||
@ -52,4 +53,8 @@ transform = Transform3D(0.759866, 0, 0, 0, 0.759866, 0, 0, 0, 0.759866, 0, 0, 0)
|
||||
[node name="UiOrigin" parent="." index="6"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.531, 0)
|
||||
|
||||
[node name="MoveSoundPlayer" parent="." index="9"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.25, 0)
|
||||
stream = ExtResource("5_f4mon")
|
||||
|
||||
[editable path="AphidModel"]
|
||||
|
||||
@ -31,6 +31,7 @@ var _advance_anim_delta_accum: float = 0
|
||||
@onready var audio_player: SoundEffectsPlayer = (
|
||||
$SoundEffectsPlayer
|
||||
)
|
||||
@onready var move_audio_player: AudioStreamPlayer3D = $MoveSoundPlayer;
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@ -40,8 +41,11 @@ func _ready() -> void:
|
||||
assert(ui_origin != null, "ui_origin missing!")
|
||||
assert(anim_advance_indicator != null, "anim_advance_indicator missing!")
|
||||
assert(audio_player != null, "audio_player missing!")
|
||||
assert(move_audio_player != null, "move_audio_player missing!")
|
||||
super._ready()
|
||||
|
||||
move_audio_player.pitch_scale += randf_range(-0.25, 0.25)
|
||||
|
||||
anim_advance_indicator.visible = false
|
||||
if _spawn_pos != null and _spawn_pos != Vector3.ZERO:
|
||||
global_position = _spawn_pos
|
||||
@ -63,6 +67,7 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
_handle_animation(delta)
|
||||
_handle_move_sound()
|
||||
showing_info = UiManager.unit_info.unit == self
|
||||
|
||||
|
||||
@ -126,6 +131,16 @@ func _handle_animation(delta: float) -> void:
|
||||
anim_advance_indicator.visible = advance and DebugManager.enabled
|
||||
|
||||
|
||||
func _handle_move_sound() -> void:
|
||||
if move_audio_player.stream == null:
|
||||
return
|
||||
|
||||
if move_audio_player.playing and velocity.length() < _move_speed / 2:
|
||||
move_audio_player.stop()
|
||||
if not move_audio_player.playing and velocity.length() >= _move_speed / 2:
|
||||
move_audio_player.play(randf() * move_audio_player.stream.get_length())
|
||||
|
||||
|
||||
func _wander(delta: float) -> void:
|
||||
_wandering_timer -= delta
|
||||
if _wandering_timer <= 0:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user