Add sound effects.
加入音效。
This commit is contained in:
parent
d143cf8dbf
commit
c397aff026
15
default_bus_layout.tres
Normal file
15
default_bus_layout.tres
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_resource type="AudioBusLayout" format=3 uid="uid://cdugntqhtcyd"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bus/1/name = &"BGM"
|
||||||
|
bus/1/solo = false
|
||||||
|
bus/1/mute = false
|
||||||
|
bus/1/bypass_fx = false
|
||||||
|
bus/1/volume_db = 0.0
|
||||||
|
bus/1/send = &"Master"
|
||||||
|
bus/2/name = &"SoundEffect"
|
||||||
|
bus/2/solo = false
|
||||||
|
bus/2/mute = false
|
||||||
|
bus/2/bypass_fx = false
|
||||||
|
bus/2/volume_db = -0.0127316
|
||||||
|
bus/2/send = &"Master"
|
|
@ -59,3 +59,5 @@ position = Vector2(15, 20)
|
||||||
[node name="DamageNumber" type="Marker2D" parent="."]
|
[node name="DamageNumber" type="Marker2D" parent="."]
|
||||||
position = Vector2(0, -47)
|
position = Vector2(0, -47)
|
||||||
script = ExtResource("3_lrmsw")
|
script = ExtResource("3_lrmsw")
|
||||||
|
|
||||||
|
[node name="AudioListener2D" type="AudioListener2D" parent="."]
|
||||||
|
|
|
@ -15,10 +15,6 @@ collision_mask = 38
|
||||||
script = ExtResource("1_slakl")
|
script = ExtResource("1_slakl")
|
||||||
NumberSlots = 30
|
NumberSlots = 30
|
||||||
Id = "packsack"
|
Id = "packsack"
|
||||||
UniqueName = null
|
|
||||||
UniqueDescription = null
|
|
||||||
_minContactInjury = null
|
|
||||||
_maxContactInjury = null
|
|
||||||
|
|
||||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||||
collision_layer = 8
|
collision_layer = 8
|
||||||
|
|
|
@ -30,3 +30,7 @@ collision_mask = 78
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionDetectionArea"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionDetectionArea"]
|
||||||
shape = SubResource("CircleShape2D_8117d")
|
shape = SubResource("CircleShape2D_8117d")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
bus = &"SoundEffect"
|
||||||
|
area_mask = 16
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://dnnn2xyayiehk"]
|
[gd_scene load_steps=7 format=3 uid="uid://dnnn2xyayiehk"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://e6670ykyq145" path="res://sprites/weapon/staffOfTheUndead.png" id="1_ms3us"]
|
[ext_resource type="Texture2D" uid="uid://e6670ykyq145" path="res://sprites/weapon/staffOfTheUndead.png" id="1_ms3us"]
|
||||||
[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w8hhv"]
|
[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w8hhv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c01av43yk1q71" path="res://prefab/projectile/curseOfTheUndead.tscn" id="2_34250"]
|
[ext_resource type="PackedScene" uid="uid://c01av43yk1q71" path="res://prefab/projectile/curseOfTheUndead.tscn" id="2_34250"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_ffr2k"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"]
|
||||||
size = Vector2(49, 5)
|
size = Vector2(49, 5)
|
||||||
|
@ -36,3 +37,7 @@ shape = SubResource("RectangleShape2D_14m1g")
|
||||||
|
|
||||||
[node name="Marker2D" type="Marker2D" parent="."]
|
[node name="Marker2D" type="Marker2D" parent="."]
|
||||||
position = Vector2(65, 0)
|
position = Vector2(65, 0)
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Marker2D"]
|
||||||
|
stream = ExtResource("4_ffr2k")
|
||||||
|
bus = &"SoundEffect"
|
||||||
|
|
|
@ -80,7 +80,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
||||||
|
|
||||||
//If it leaves the ground or walls.
|
//If it leaves the ground or walls.
|
||||||
//如果离开了地面或墙壁。
|
//如果离开了地面或墙壁。
|
||||||
if (node is TileMap)
|
if (node is TileMapLayer)
|
||||||
{
|
{
|
||||||
_tileMapNumber--;
|
_tileMapNumber--;
|
||||||
if (_tileMapNumber == 0)
|
if (_tileMapNumber == 0)
|
||||||
|
@ -105,7 +105,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node is TileMap)
|
if (node is TileMapLayer)
|
||||||
{
|
{
|
||||||
_tileMapNumber++;
|
_tileMapNumber++;
|
||||||
EnableContactInjury = false;
|
EnableContactInjury = false;
|
||||||
|
|
|
@ -13,6 +13,18 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
{
|
{
|
||||||
private float _gravity = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle();
|
private float _gravity = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Fire audio playback component</para>
|
||||||
|
/// <para>开火音效播放组件</para>
|
||||||
|
/// </summary>
|
||||||
|
private AudioStreamPlayer2D? _audioStreamPlayer2D;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
base._Ready();
|
||||||
|
_audioStreamPlayer2D = GetNodeOrNull<AudioStreamPlayer2D>("Marker2D/AudioStreamPlayer2D");
|
||||||
|
}
|
||||||
|
|
||||||
public override void Use(Node2D? owner, Vector2 targetGlobalPosition)
|
public override void Use(Node2D? owner, Vector2 targetGlobalPosition)
|
||||||
{
|
{
|
||||||
Fire(owner, targetGlobalPosition);
|
Fire(owner, targetGlobalPosition);
|
||||||
|
@ -93,6 +105,7 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_audioStreamPlayer2D?.Play();
|
||||||
DoFire(owner, enemyGlobalPosition);
|
DoFire(owner, enemyGlobalPosition);
|
||||||
_lastFiringTime = nowTime;
|
_lastFiringTime = nowTime;
|
||||||
}
|
}
|
||||||
|
|
BIN
sounds/fire.wav
Normal file
BIN
sounds/fire.wav
Normal file
Binary file not shown.
24
sounds/fire.wav.import
Normal file
24
sounds/fire.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://cak6chjjsu7wo"
|
||||||
|
path="res://.godot/imported/fire.wav-bffbfc47d9390c80437953e7f312d8b6.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sounds/fire.wav"
|
||||||
|
dest_files=["res://.godot/imported/fire.wav-bffbfc47d9390c80437953e7f312d8b6.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
|
Loading…
Reference in New Issue
Block a user