Weapon sounds

This commit is contained in:
Marco 2025-09-11 10:54:02 +02:00
commit 280af2fcfa
7 changed files with 158 additions and 188 deletions

File diff suppressed because one or more lines are too long

View file

@ -16,15 +16,6 @@
}
// brush 1
{
( -256 -72 -56 ) ( -256 -71 -56 ) ( -256 -72 -55 ) Manual/Grid_002 [ 0 -1 0 0 ] [ 0 0 -1 8 ] 90 1 1
( -256 -72 -56 ) ( -256 -72 -55 ) ( -255 -72 -56 ) Manual/Grid_002 [ 1 0 0 8 ] [ 0 0 -1 8 ] 90 1 1
( -256 -72 -40 ) ( -255 -72 -40 ) ( -256 -71 -40 ) Manual/Grid_002 [ -1 0 0 -8 ] [ 0 -1 0 0 ] 0 1 1
( -128 56 -24 ) ( -128 57 -24 ) ( -127 56 -24 ) Manual/Grid_002 [ 1 0 0 8 ] [ 0 -1 0 0 ] 90 1 1
( -128 56 -24 ) ( -127 56 -24 ) ( -128 56 -23 ) Manual/Grid_002 [ -1 0 0 -8 ] [ 0 0 -1 8 ] 90 1 1
( -128 56 -24 ) ( -128 56 -23 ) ( -128 57 -24 ) Manual/Grid_002 [ 0 1 0 0 ] [ 0 0 -1 8 ] 90 1 1
}
// brush 2
{
( -56 64 16 ) ( -56 65 16 ) ( -56 64 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -56 64 16 ) ( -56 64 17 ) ( -55 64 16 ) Manual/Grid_005 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -56 64 16 ) ( -55 64 16 ) ( -56 65 16 ) Manual/Grid_005 [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
@ -32,7 +23,7 @@
( 0 72 24 ) ( 1 72 24 ) ( 0 72 25 ) Manual/Grid_005 [ -1 0 0 -1 ] [ 0 0 -1 0 ] 0 1 1
( 0 72 24 ) ( 0 72 25 ) ( 0 73 24 ) Manual/Grid_005 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 3
// brush 2
{
( 32 64 16 ) ( 32 65 16 ) ( 32 64 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 16 64 16 ) ( 16 64 17 ) ( 17 64 16 ) Manual/Grid_005 [ 1 0 0 8 ] [ 0 0 -1 0 ] 180 1 1
@ -41,7 +32,7 @@
( 72 72 24 ) ( 73 72 24 ) ( 72 72 25 ) Manual/Grid_005 [ -1 0 0 7 ] [ 0 0 -1 0 ] 180 1 1
( 80 72 24 ) ( 80 72 25 ) ( 80 73 24 ) Manual/Grid_005 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 4
// brush 3
{
( -56 72 -16 ) ( -56 73 -16 ) ( -56 72 -15 ) Manual/Grid_Small_001 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 90 1 1
( -56 72 -16 ) ( -56 72 -15 ) ( -55 72 -16 ) special/clip [ 1 0 0 0 ] [ 0 0 -1 0 ] 90 1 1
@ -50,7 +41,7 @@
( 72 208 16 ) ( 73 208 16 ) ( 72 208 17 ) Manual/Grid_Small_001 [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 80 200 16 ) ( 80 200 17 ) ( 80 201 16 ) Manual/Grid_Small_001 [ 0 1 0 0 ] [ 0 0 -1 0 ] 270 1 1
}
// brush 5
// brush 4
{
( -56 -48 16 ) ( -56 -47 16 ) ( -56 -48 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -56 -56 16 ) ( -56 -56 17 ) ( -55 -56 16 ) Manual/Grid_005 [ 1 0 0 0 ] [ 0 0 -1 0 ] 270 1 1
@ -59,7 +50,7 @@
( 0 64 24 ) ( 1 64 24 ) ( 0 64 25 ) Manual/Grid_005 [ -1 0 0 0 ] [ 0 0 -1 0 ] 180 1 1
( -48 -40 24 ) ( -48 -40 25 ) ( -48 -39 24 ) Manual/Grid_005 [ 0 1 0 -1 ] [ 0 0 -1 0 ] 270 1 1
}
// brush 6
// brush 5
{
( 80 -48 16 ) ( 80 -47 16 ) ( 80 -48 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 80 -56 16 ) ( 80 -56 17 ) ( 81 -56 16 ) Manual/Grid_005 [ 1 0 0 8 ] [ 0 0 -1 0 ] 0 1 1
@ -68,7 +59,7 @@
( 136 64 24 ) ( 137 64 24 ) ( 136 64 25 ) Manual/Grid_005 [ -1 0 0 -8 ] [ 0 0 -1 0 ] 270 1 1
( 88 -40 24 ) ( 88 -40 25 ) ( 88 -39 24 ) Manual/Grid_005 [ 0 1 0 -1 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 7
// brush 6
{
( -48 -56 16 ) ( -48 -55 16 ) ( -48 -56 17 ) Manual/Grid_005 [ 0 -1 0 8 ] [ 0 0 -1 0 ] 90 1 1
( -72 -56 16 ) ( -72 -56 17 ) ( -71 -56 16 ) Manual/Grid_005 [ 1 0 0 0 ] [ 0 0 -1 0 ] 270 1 1
@ -77,7 +68,7 @@
( -16 -48 24 ) ( -15 -48 24 ) ( -16 -48 25 ) Manual/Grid_005 [ -1 0 0 -1 ] [ 0 0 -1 0 ] 270 1 1
( 80 -48 24 ) ( 80 -48 25 ) ( 80 -47 24 ) Manual/Grid_005 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 90 1 1
}
// brush 8
// brush 7
{
( -56 88 16 ) ( -56 89 16 ) ( -56 88 17 ) Manual/Grid_005 [ 0 -1 0 8 ] [ 0 0 -1 0 ] 90 1 1
( -56 72 16 ) ( -56 72 17 ) ( -55 72 16 ) Manual/Grid_005 [ 1 0 0 0 ] [ 0 0 -1 0 ] 270 1 1
@ -86,7 +77,7 @@
( 0 200 24 ) ( 1 200 24 ) ( 0 200 25 ) Manual/Grid_005 [ -1 0 0 0 ] [ 0 0 -1 0 ] 270 1 1
( -48 96 24 ) ( -48 96 25 ) ( -48 97 24 ) Manual/Grid_005 [ 0 1 0 -9 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 9
// brush 8
{
( 80 80 16 ) ( 80 81 16 ) ( 80 80 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 270 1 1
( 80 64 16 ) ( 80 64 17 ) ( 81 64 16 ) Manual/Grid_005 [ 1 0 0 8 ] [ 0 0 -1 0 ] 90 1 1
@ -95,16 +86,7 @@
( 136 344 24 ) ( 137 344 24 ) ( 136 344 25 ) Manual/Grid_005 [ -1 0 0 -8 ] [ 0 0 -1 0 ] 180 1 1
( 88 88 24 ) ( 88 88 25 ) ( 88 89 24 ) Manual/Grid_005 [ 0 1 0 -1 ] [ 0 0 -1 0 ] 180 1 1
}
// brush 10
{
( -256 16 -32 ) ( -256 17 -32 ) ( -256 16 -31 ) __TB_empty [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -256 16 -32 ) ( -256 16 -31 ) ( -255 16 -32 ) __TB_empty [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -256 16 -32 ) ( -255 16 -32 ) ( -256 17 -32 ) __TB_empty [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( -112 336 -16 ) ( -112 337 -16 ) ( -111 336 -16 ) __TB_empty [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( -112 336 -16 ) ( -111 336 -16 ) ( -112 336 -15 ) __TB_empty [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -112 336 -16 ) ( -112 336 -15 ) ( -112 337 -16 ) __TB_empty [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 11
// brush 9
{
( -24 -48 20 ) ( -24 -47 20 ) ( -24 -48 21 ) __TB_empty [ 0 -1 0 0 ] [ 0 0 -1 4 ] 180 1 1
( -24 -48 20 ) ( -24 -48 21 ) ( -23 -48 20 ) __TB_empty [ 1 0 0 -4 ] [ 0 0 -1 4 ] 180 1 1
@ -113,7 +95,7 @@
( -20 -28 24 ) ( -19 -28 24 ) ( -20 -28 25 ) __TB_empty [ -1 0 0 4 ] [ 0 0 -1 4 ] 180 1 1
( -20 -28 24 ) ( -20 -28 25 ) ( -20 -27 24 ) __TB_empty [ 0 1 0 0 ] [ 0 0 -1 4 ] 180 1 1
}
// brush 12
// brush 10
{
( -24 -32 16 ) ( -24 -31 16 ) ( -24 -32 17 ) __TB_empty [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -24 -32 16 ) ( -24 -32 17 ) ( -23 -32 16 ) __TB_empty [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
@ -122,7 +104,7 @@
( -20 -28 20 ) ( -19 -28 20 ) ( -20 -28 21 ) __TB_empty [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -20 -28 20 ) ( -20 -28 21 ) ( -20 -27 20 ) __TB_empty [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 13
// brush 11
{
( -56 200 16 ) ( -56 201 16 ) ( -56 200 17 ) Manual/Grid_005 [ 0 -1 0 8 ] [ 0 0 -1 0 ] 90 1 1
( -48 200 16 ) ( -48 200 17 ) ( -47 200 16 ) Manual/Grid_005 [ 1 0 0 -8 ] [ 0 0 -1 0 ] 180 1 1
@ -131,7 +113,7 @@
( 8 208 24 ) ( 9 208 24 ) ( 8 208 25 ) Manual/Grid_005 [ -1 0 0 7 ] [ 0 0 -1 0 ] 180 1 1
( 8 208 24 ) ( 8 208 25 ) ( 8 209 24 ) Manual/Grid_005 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 180 1 1
}
// brush 14
// brush 12
{
( 32 200 16 ) ( 32 201 16 ) ( 32 200 17 ) Manual/Grid_005 [ 0 -1 0 8 ] [ 0 0 -1 0 ] 90 1 1
( 16 200 16 ) ( 16 200 17 ) ( 17 200 16 ) Manual/Grid_005 [ 1 0 0 8 ] [ 0 0 -1 0 ] 180 1 1
@ -140,7 +122,7 @@
( 72 208 24 ) ( 73 208 24 ) ( 72 208 25 ) Manual/Grid_005 [ -1 0 0 7 ] [ 0 0 -1 0 ] 180 1 1
( 80 208 24 ) ( 80 208 25 ) ( 80 209 24 ) Manual/Grid_005 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 15
// brush 13
{
( -56 208 -16 ) ( -56 209 -16 ) ( -56 208 -15 ) Manual/Grid_Small_001 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -56 208 -16 ) ( -56 208 -15 ) ( -55 208 -16 ) special/clip [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
@ -149,7 +131,7 @@
( 72 336 16 ) ( 73 336 16 ) ( 72 336 17 ) Manual/Grid_Small_001 [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 80 336 16 ) ( 80 336 17 ) ( 80 337 16 ) Manual/Grid_Small_001 [ 0 1 0 0 ] [ 0 0 -1 0 ] 180 1 1
}
// brush 16
// brush 14
{
( -56 336 16 ) ( -56 337 16 ) ( -56 336 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 16 336 16 ) ( 16 336 17 ) ( 17 336 16 ) Manual/Grid_005 [ 1 0 0 8 ] [ 0 0 -1 0 ] 270 1 1
@ -158,7 +140,7 @@
( 72 344 24 ) ( 73 344 24 ) ( 72 344 25 ) Manual/Grid_005 [ -1 0 0 7 ] [ 0 0 -1 0 ] 270 1 1
( 80 344 24 ) ( 80 344 25 ) ( 80 345 24 ) Manual/Grid_005 [ 0 1 0 0 ] [ 0 0 -1 0 ] 90 1 1
}
// brush 17
// brush 15
{
( -56 304 16 ) ( -56 305 16 ) ( -56 304 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 270 1 1
( -56 288 16 ) ( -56 288 17 ) ( -55 288 16 ) Manual/Grid_005 [ 1 0 0 0 ] [ 0 0 -1 0 ] 90 1 1
@ -167,7 +149,7 @@
( 0 336 24 ) ( 1 336 24 ) ( 0 336 25 ) Manual/Grid_005 [ -1 0 0 0 ] [ 0 0 -1 0 ] 180 1 1
( -48 312 24 ) ( -48 312 25 ) ( -48 313 24 ) Manual/Grid_005 [ 0 1 0 15 ] [ 0 0 -1 0 ] 180 1 1
}
// brush 18
// brush 16
{
( -56 224 16 ) ( -56 225 16 ) ( -56 224 17 ) Manual/Grid_005 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 90 1 1
( -56 208 16 ) ( -56 208 17 ) ( -55 208 16 ) Manual/Grid_005 [ 1 0 0 0 ] [ 0 0 -1 0 ] 270 1 1
@ -226,40 +208,10 @@
}
// entity 10
{
"classname" "actor_forcefield_1"
"origin" "-212 -16 -8"
}
// entity 11
{
"classname" "actor_mainframe"
"origin" "-200 152 -4"
}
// entity 12
{
"classname" "actor_stairs_mini"
"origin" "-200 280 -12"
}
// entity 13
{
"classname" "actor_table"
"origin" "-168 100 -12"
}
// entity 14
{
"classname" "actor_tank"
"origin" "-232 296 -8"
}
// entity 15
{
"classname" "actor_wallfan"
"origin" "-210 212 -4"
}
// entity 16
{
"classname" "actor_teleporter"
"origin" "-40 -40 17"
}
// entity 17
// entity 11
{
"classname" "actor_controlpad"
"origin" "-44 28 28"

View file

@ -1,12 +1,7 @@
[gd_scene load_steps=16 format=3 uid="uid://dorx2l3svs58g"]
[gd_scene load_steps=11 format=3 uid="uid://dorx2l3svs58g"]
[ext_resource type="Script" uid="uid://b8g8mflgsr5dc" path="res://Scripts/GameController.cs" id="1_jexas"]
[ext_resource type="PackedScene" uid="uid://bv7tjma3g7nkf" path="res://Scenes/Actors/3D/game_controller.tscn" id="1_wkf2e"]
[ext_resource type="Resource" uid="uid://b32mqmglcdo64" path="res://Resources/Maps/3D/Tutorial_3D.tres" id="2_b1fwp"]
[ext_resource type="PackedScene" uid="uid://rimplblbptcd" path="res://Scenes/Actors/IsoPlayer_FSM.tscn" id="3_gvqvx"]
[ext_resource type="PackedScene" uid="uid://dkwi1hu1bixoe" path="res://Scenes/HUD/HUD.tscn" id="4_dhiwy"]
[ext_resource type="Script" uid="uid://c5nxsq3tyxcx6" path="res://Scripts/InventoryManager.cs" id="5_nv8if"]
[ext_resource type="Script" uid="uid://cnkipcolyj61w" path="res://Scripts/AlarmManager.cs" id="6_cuqta"]
[ext_resource type="AudioStream" uid="uid://blohh20jktoyo" path="res://SFX/270641__phantastonia__alarm2.wav" id="7_xbksb"]
[ext_resource type="Texture2D" uid="uid://du8xcvbnf30o2" path="res://ExternalMaterial/Barrel/Barrels.png" id="8_u0dpd"]
[ext_resource type="Script" uid="uid://dnslcy71dgea" path="res://Scripts/Misc/CameraTarget3D.cs" id="10_xdccr"]
[ext_resource type="Script" uid="uid://ba0tf7ihw4hpp" path="res://Scripts/Misc/CameraController3D.cs" id="11_ysphp"]
@ -26,25 +21,14 @@ sky = SubResource("Sky_yt8i6")
[node name="TutorialGameplay" type="Node3D"]
[node name="GameController" type="Node" parent="." node_paths=PackedStringArray("_cameraTarget", "PlayerParentNode")]
script = ExtResource("1_jexas")
[node name="GameController" parent="." node_paths=PackedStringArray("_cameraTarget", "PlayerParentNode") instance=ExtResource("1_wkf2e")]
_cameraTarget = NodePath("../CameraTarget")
MapResource = ExtResource("2_b1fwp")
PlayerTemplate = ExtResource("3_gvqvx")
SpawnMarkers = Dictionary[int, NodePath]({
0: NodePath("../StartPosition")
0: NodePath("../CameraTarget")
})
PlayerParentNode = NodePath("..")
[node name="InventoryManager" type="Node" parent="GameController"]
script = ExtResource("5_nv8if")
[node name="HUD" parent="GameController" instance=ExtResource("4_dhiwy")]
[node name="AlarmManager" type="Node" parent="GameController"]
script = ExtResource("6_cuqta")
AlarmSound = ExtResource("7_xbksb")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.442606, -0.744379, 0.5, 0.287606, 0.645974, 0.707107, -0.849343, -0.169166, 0.5, 30.2584, 5.82742, 20.7297)
light_energy = 1.375
@ -75,12 +59,12 @@ hframes = 4
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 79.7225, 1.57535, -7.40793)
[node name="CameraTarget" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.0389, 2.33215, 3.16925)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 78.07424, 2.33215, -8.145325)
script = ExtResource("10_xdccr")
[node name="Camera3D" type="Camera3D" parent="."]
physics_interpolation_mode = 1
transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 26.5146, 7.935, 10.4923)
transform = Transform3D(0.7071068, -0.49999994, 0.5000001, 0, 0.70710695, 0.7071067, -0.7071068, -0.49999994, 0.5000001, 83.54994, 7.935, -0.82227516)
projection = 1
size = 7.537
script = ExtResource("11_ysphp")

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://cfgc6ik8vb08c"]
[gd_scene load_steps=4 format=3 uid="uid://cfgc6ik8vb08c"]
[ext_resource type="Script" uid="uid://dutroqc0grqyv" path="res://Scripts/Weapons/Weapon3D.cs" id="1_gdxml"]
[ext_resource type="Texture2D" uid="uid://duwiasewxvcb5" path="res://Sprites/Items/Icicle_Gun.png" id="3_6jcxd"]
[ext_resource type="Script" uid="uid://cqwi5bt8mxykn" path="res://Scripts/Weapons/WeaponSoundModule3D.cs" id="3_s6td3"]
[node name="Weapon" type="Node3D" node_paths=PackedStringArray("Muzzle", "Pivot", "Sprite")]
script = ExtResource("1_gdxml")
@ -22,3 +23,19 @@ pixel_size = 0.05
billboard = 1
texture_filter = 0
texture = ExtResource("3_6jcxd")
[node name="SoundModule" type="Node" parent="." node_paths=PackedStringArray("Weapon", "ShootSound", "ReloadSound", "EmptySound")]
script = ExtResource("3_s6td3")
Weapon = NodePath("..")
ShootSound = NodePath("ShootSound")
ReloadSound = NodePath("ReloadSound")
EmptySound = NodePath("EmptySound")
[node name="ShootSound" type="AudioStreamPlayer3D" parent="SoundModule"]
bus = &"Effects"
[node name="ReloadSound" type="AudioStreamPlayer3D" parent="SoundModule"]
bus = &"Effects"
[node name="EmptySound" type="AudioStreamPlayer3D" parent="SoundModule"]
bus = &"Effects"

View file

@ -29,6 +29,9 @@ public partial class Weapon3D : Node3D
[Signal]
public delegate void EmptyEventHandler();
[Signal]
public delegate void InitializedEventHandler();
public int Ammo { get; set; } = 0;
private int _loadedAmmo;
@ -83,6 +86,8 @@ public partial class Weapon3D : Node3D
{
LoadedAmmo = WeaponData.BulletCapacity;
}
EmitSignalInitialized();
}
private void RechargeTimerOnTimeout()

View file

@ -0,0 +1,55 @@
using Godot;
namespace Cirno.Scripts.Weapons;
public partial class WeaponSoundModule3D : Node
{
[Export] public Weapon3D Weapon { get; private set; }
[Export] public AudioStreamPlayer3D ShootSound { get; private set; }
[Export] public AudioStreamPlayer3D ReloadSound { get; private set; }
[Export] public AudioStreamPlayer3D EmptySound { get; private set; }
public override void _Ready()
{
Weapon.Initialized += WeaponOnInitialized;
}
private void WeaponOnInitialized()
{
if (Weapon?.WeaponData is null) return;
if (Weapon.WeaponData.ShootSound is not null)
{
ShootSound.Stream = Weapon.WeaponData.ShootSound;
Weapon.Shooting += WeaponOnShooting;
}
if (Weapon.WeaponData.ReloadSound is not null)
{
ReloadSound.Stream = Weapon.WeaponData.ReloadSound;
Weapon.Reloading += WeaponOnReloading;
}
if (Weapon.WeaponData.EmptySound is not null)
{
EmptySound.Stream = Weapon.WeaponData.EmptySound;
Weapon.Empty += WeaponOnEmpty;
}
}
private void WeaponOnEmpty()
{
EmptySound.Play();
}
private void WeaponOnReloading()
{
ReloadSound.Play();
}
private void WeaponOnShooting()
{
ShootSound.Play();
}
}

View file

@ -0,0 +1 @@
uid://cqwi5bt8mxykn