Add health pickup sfx
This commit is contained in:
parent
94c050b444
commit
c5308af272
@ -83,6 +83,12 @@ link = "https://opengameart.org/content/thrust-sequence"
|
||||
credit = "Space Dimensions (8bit/Retro Version)"
|
||||
link = "https://opengameart.org/content/space-dimensions-8bitretro-version"
|
||||
|
||||
[[people]]
|
||||
name = "ViRiX"
|
||||
[[people.credits]]
|
||||
credit = "UI and Item sound effect Jingles Sample 2"
|
||||
link = "https://opengameart.org/content/ui-and-item-sound-effect-jingles-sample-2"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit b706f8fb162116a401080de777588e6ddd322875
|
||||
Subproject commit 098b9f812aa3b76f61b2deda68f3a8f5f30e6300
|
||||
@ -1,15 +1,17 @@
|
||||
[gd_scene format=3 uid="uid://dov2eh5u4ypnx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d0hq2ctndreej" path="res://mesh/health_pickup.tscn" id="1_1mios"]
|
||||
[ext_resource type="AudioStream" uid="uid://c5ml80euqj27k" path="res://raw_assets/sfx/menu_and_item_jingles/Menu2A.wav" id="2_ogdjc"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_1cgct"]
|
||||
radius = 0.8577998
|
||||
|
||||
[node name="health_pickup" type="HealthPickup" unique_id=1860192333 node_paths=PackedStringArray("pickup_area")]
|
||||
[node name="health_pickup" type="HealthPickup" unique_id=1860192333 node_paths=PackedStringArray("pickup_area", "sfx")]
|
||||
pickup_area = NodePath("area_3d")
|
||||
sfx = NodePath("audio_stream_player_3d")
|
||||
|
||||
[node name="area_3d" type="Area3D" parent="." unique_id=168425054]
|
||||
transform = Transform3D(-0.4998196, 0, 0.8661295, 0, 1, 0, -0.8661295, 0, -0.4998196, 0, 1.7165325, 0)
|
||||
transform = Transform3D(0.9148415, 0, -0.4038132, 0, 1, 0, 0.4038132, 0, 0.9148415, 0, 1.3990467, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 3
|
||||
|
||||
@ -17,3 +19,6 @@ collision_mask = 3
|
||||
|
||||
[node name="collision_shape_3d" type="CollisionShape3D" parent="area_3d" unique_id=1572818215]
|
||||
shape = SubResource("SphereShape3D_1cgct")
|
||||
|
||||
[node name="audio_stream_player_3d" type="AudioStreamPlayer3D" parent="." unique_id=2139430866]
|
||||
stream = ExtResource("2_ogdjc")
|
||||
|
||||
@ -1251,7 +1251,7 @@ impl Game {
|
||||
if let Some(recorder) = &mut s.replay_recorder {
|
||||
recorder
|
||||
.bind_mut()
|
||||
.record_event(ReplayEvent::Pickup(kind, player_id));
|
||||
.record_event(ReplayEvent::Pickup(kind, id, player_id));
|
||||
}
|
||||
|
||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
use godot::{classes::Area3D, prelude::*};
|
||||
use godot::{
|
||||
classes::{Area3D, AudioStreamPlayer3D},
|
||||
prelude::*,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
@ -24,6 +27,8 @@ pub enum ReplayVisibility {
|
||||
pub struct HealthPickup {
|
||||
#[export]
|
||||
pub pickup_area: Option<Gd<Area3D>>,
|
||||
#[export]
|
||||
pub sfx: Option<Gd<AudioStreamPlayer3D>>,
|
||||
|
||||
time_elapsed: f64,
|
||||
pickup_id: Option<u8>,
|
||||
@ -97,6 +102,9 @@ impl Pickup for HealthPickup {
|
||||
|
||||
fn on_pickup(&mut self) {
|
||||
self.respawn = 30.;
|
||||
if let Some(sfx) = &mut self.sfx {
|
||||
sfx.play();
|
||||
}
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
|
||||
@ -351,10 +351,15 @@ impl INode for ReplayPlayback {
|
||||
.take_damage(*damage_source, *damage, false);
|
||||
}
|
||||
}
|
||||
ReplayEvent::Pickup(kind, player_id) => {
|
||||
ReplayEvent::Pickup(kind, pickup_id, player_id) => {
|
||||
if let Some(character) = self.player_characters.get_mut(player_id) {
|
||||
character.bind_mut().on_pickup(*kind);
|
||||
}
|
||||
if let Some(map) = &mut self.current_map
|
||||
&& let Some(pickup) = map.bind_mut().pickups.get_mut(pickup_id)
|
||||
{
|
||||
pickup.dyn_bind_mut().on_pickup();
|
||||
}
|
||||
}
|
||||
ReplayEvent::TelegrenadeSpawn(player_id, location, velocity) => {
|
||||
if let Some(prev_grenade) = self.telegrenades.get_mut(player_id) {
|
||||
@ -735,7 +740,7 @@ pub enum ReplayEvent {
|
||||
Jump(u16),
|
||||
Punch(u16, NetVector3),
|
||||
TakeDamage(u16, DamageSource, i32),
|
||||
Pickup(PickupKind, u16),
|
||||
Pickup(PickupKind, u8, u16),
|
||||
TelegrenadeSpawn(u16, NetVector3, NetVector3),
|
||||
TelegrenadeDespawn(u16),
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user