Add goal sounds
This commit is contained in:
parent
ef762ca192
commit
f5af799531
@ -27,6 +27,12 @@ credit = "Hit sound effect"
|
|||||||
[[people.credits]]
|
[[people.credits]]
|
||||||
credit = "Footsteps"
|
credit = "Footsteps"
|
||||||
link = "https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-trunk"
|
link = "https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-trunk"
|
||||||
|
[[people.credits]]
|
||||||
|
credit = "Wine glasses full of wine and ice clink together, cheers, celebration, version 6"
|
||||||
|
link = "https://www.zapsplat.com/music/wine-glasses-full-of-wine-and-ice-clink-together-cheers-celebration-version-6/"
|
||||||
|
[[people.credits]]
|
||||||
|
credit = " Drinking glasses, champagne flutes with champagne in clink together, cheers, celebrating, version 4"
|
||||||
|
link = "https://www.zapsplat.com/music/drinking-glasses-champagne-flutes-with-champagne-in-clink-together-cheers-celebrating-version-4/"
|
||||||
|
|
||||||
[[people]]
|
[[people]]
|
||||||
name = "TripleSnail"
|
name = "TripleSnail"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 098b9f812aa3b76f61b2deda68f3a8f5f30e6300
|
Subproject commit 7f88273259f449fd9f2b5370f7a67cd711d7562f
|
||||||
@ -5,6 +5,8 @@
|
|||||||
[ext_resource type="Shader" uid="uid://datt1r440base" path="res://shaders/vignette.tres" id="3_7awel"]
|
[ext_resource type="Shader" uid="uid://datt1r440base" path="res://shaders/vignette.tres" id="3_7awel"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c1gs6cqek1qlq" path="res://scenes/ui/hud.tscn" id="5_cv68x"]
|
[ext_resource type="PackedScene" uid="uid://c1gs6cqek1qlq" path="res://scenes/ui/hud.tscn" id="5_cv68x"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bdfqu6p74pfwe" path="res://raw_assets/crosshair/Crosshair 1.png" id="6_7awel"]
|
[ext_resource type="Texture2D" uid="uid://bdfqu6p74pfwe" path="res://raw_assets/crosshair/Crosshair 1.png" id="6_7awel"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://upjuu3vc7tcs" path="res://raw_assets/sfx/zapsplat_glass/zapsplat_household_wine_glasses_full_wine_and_ice_clink_together_cheers_celebrate_006_111350.mp3" id="6_dguuj"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://jktwx7dyak2f" path="res://raw_assets/sfx/zapsplat_glass/zapsplat_household_drinking_glasses_champagne_flutes_full_champagne_clink_together_cheers_celebrate_004_111316.mp3" id="7_3nqsm"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bfg31e3s4jv8c" path="res://raw_assets/sfx/Hit.mp3" id="7_dguuj"]
|
[ext_resource type="AudioStream" uid="uid://bfg31e3s4jv8c" path="res://raw_assets/sfx/Hit.mp3" id="7_dguuj"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
|
||||||
@ -15,7 +17,7 @@ shader_parameter/Color = Color(1, 0, 0, 1)
|
|||||||
shader_parameter/RimDistance = 0.7
|
shader_parameter/RimDistance = 0.7
|
||||||
shader_parameter/FloatParameter = 3.0
|
shader_parameter/FloatParameter = 3.0
|
||||||
|
|
||||||
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "vignette", "soldier_mesh", "collider", "effects", "dead_cam_target", "respawn_label", "camera_origin", "weapon_node", "hud", "hit_sound")]
|
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "vignette", "soldier_mesh", "collider", "effects", "dead_cam_target", "respawn_label", "camera_origin", "weapon_node", "hud", "hit_sound", "goal_sound_good", "goal_sound_bad")]
|
||||||
look_sensitivity = 1.5
|
look_sensitivity = 1.5
|
||||||
camera = NodePath("camera_3d")
|
camera = NodePath("camera_3d")
|
||||||
vignette = NodePath("vignette")
|
vignette = NodePath("vignette")
|
||||||
@ -29,6 +31,8 @@ camera_origin = NodePath("camera_3d")
|
|||||||
weapon_node = NodePath("camera_3d/weapon_node")
|
weapon_node = NodePath("camera_3d/weapon_node")
|
||||||
hud = NodePath("hud")
|
hud = NodePath("hud")
|
||||||
hit_sound = NodePath("hit_sound")
|
hit_sound = NodePath("hit_sound")
|
||||||
|
goal_sound_good = NodePath("goal_good")
|
||||||
|
goal_sound_bad = NodePath("goal_bad")
|
||||||
health = 100
|
health = 100
|
||||||
punch_cooldown = 1.0
|
punch_cooldown = 1.0
|
||||||
telegrenade_cd = 10.0
|
telegrenade_cd = 10.0
|
||||||
@ -99,6 +103,14 @@ horizontal_alignment = 1
|
|||||||
stream = ExtResource("7_dguuj")
|
stream = ExtResource("7_dguuj")
|
||||||
bus = &"SFX"
|
bus = &"SFX"
|
||||||
|
|
||||||
|
[node name="goal_good" type="AudioStreamPlayer" parent="." unique_id=798263606]
|
||||||
|
stream = ExtResource("6_dguuj")
|
||||||
|
bus = &"SFX"
|
||||||
|
|
||||||
|
[node name="goal_bad" type="AudioStreamPlayer" parent="." unique_id=1673136668]
|
||||||
|
stream = ExtResource("7_3nqsm")
|
||||||
|
bus = &"SFX"
|
||||||
|
|
||||||
[node name="hud" parent="." unique_id=2049159590 instance=ExtResource("5_cv68x")]
|
[node name="hud" parent="." unique_id=2049159590 instance=ExtResource("5_cv68x")]
|
||||||
|
|
||||||
[connection signal="on_exit" from="hud" to="." method="exit"]
|
[connection signal="on_exit" from="hud" to="." method="exit"]
|
||||||
|
|||||||
@ -739,6 +739,17 @@ impl Game {
|
|||||||
self.goals
|
self.goals
|
||||||
.insert(*team, self.goals.get(&team).copied().unwrap_or(0) + 1);
|
.insert(*team, self.goals.get(&team).copied().unwrap_or(0) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(self_player) = self.get_self()
|
||||||
|
&& let Some(mut local_player) = self_player.get_local_player()
|
||||||
|
{
|
||||||
|
if teams.contains(&self_player.data.team) {
|
||||||
|
local_player.bind_mut().play_local_goal_sound();
|
||||||
|
} else {
|
||||||
|
local_player.bind_mut().play_local_goal_bad_sound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.run_deferred(move |s| {
|
self.run_deferred(move |s| {
|
||||||
if let Some(mut chat) = Chat::singleton() {
|
if let Some(mut chat) = Chat::singleton() {
|
||||||
chat.bind_mut()
|
chat.bind_mut()
|
||||||
@ -1327,6 +1338,16 @@ impl Game {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_self(&self) -> Option<Player> {
|
||||||
|
if let Some(player_id) = self.self_id
|
||||||
|
&& let Some(player) = self.find_player(player_id)
|
||||||
|
{
|
||||||
|
Some(player.clone())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -1462,6 +1483,16 @@ impl Player {
|
|||||||
pub fn id(&self) -> u16 {
|
pub fn id(&self) -> u16 {
|
||||||
self.data.id
|
self.data.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_local_player(&self) -> Option<Gd<LocalPlayer>> {
|
||||||
|
if let Some(character) = self.character.clone()
|
||||||
|
&& let Ok(local_player) = character.try_cast::<LocalPlayer>()
|
||||||
|
{
|
||||||
|
Some(local_player.into_gd())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
|||||||
@ -68,6 +68,10 @@ pub struct LocalPlayer {
|
|||||||
#[export]
|
#[export]
|
||||||
hit_sound: Option<Gd<AudioStreamPlayer>>,
|
hit_sound: Option<Gd<AudioStreamPlayer>>,
|
||||||
#[export]
|
#[export]
|
||||||
|
goal_sound_good: Option<Gd<AudioStreamPlayer>>,
|
||||||
|
#[export]
|
||||||
|
goal_sound_bad: Option<Gd<AudioStreamPlayer>>,
|
||||||
|
#[export]
|
||||||
health: i32,
|
health: i32,
|
||||||
#[export]
|
#[export]
|
||||||
punch_cooldown: f64,
|
punch_cooldown: f64,
|
||||||
@ -799,6 +803,18 @@ impl LocalPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn play_local_goal_sound(&mut self) {
|
||||||
|
if let Some(goal_good) = &mut self.goal_sound_good {
|
||||||
|
goal_good.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn play_local_goal_bad_sound(&mut self) {
|
||||||
|
if let Some(goal_bad) = &mut self.goal_sound_bad {
|
||||||
|
goal_bad.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn raycast_from_camera(&self) -> Option<Vector3> {
|
fn raycast_from_camera(&self) -> Option<Vector3> {
|
||||||
if let Some(camera) = &self.camera {
|
if let Some(camera) = &self.camera {
|
||||||
let forward = camera.get_global_basis().col_c().neg();
|
let forward = camera.get_global_basis().col_c().neg();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user