Skip to content

Commit

Permalink
Make spectate mode song be music volume dependent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Praccen committed Oct 2, 2023
1 parent af1ba57 commit 27d1ec6
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions code/src/Engine/Audio/AudioPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export default class AudioPlayer {
"light_up.mp3", //https://pixabay.com/sound-effects/match-lighting-candle-81020/
"fire.mp3", //https://pixabay.com/sound-effects/small-artisanal-oven-at-night-23698/
"success_1.mp3", //https://pixabay.com/sound-effects/ahhhh-37191/
"credits_theme_1.mp3", //https://pixabay.com/music/modern-classical-simple-piano-melody-9834/
];
const sound_effect_volume_multilpliers_list = [
0.5, 0.5, 1, 1, 0.5, 0.5, 1, 1, 0.5,
0.5, 0.5, 1, 1, 0.5, 0.5, 1, 1,
];
let count = 0;
for (const file of sound_effect_files) {
Expand All @@ -42,8 +41,12 @@ export default class AudioPlayer {
count++;
}

const song_files = ["theme_1.mp3"]; //https://pixabay.com/music/scary-childrens-tunes-dark-ambient-horror-cinematic-halloween-atmosphere-scary-118585/
const song_files_volume_multilpliers_list = [0.5];
const song_files =
[
"theme_1.mp3", //https://pixabay.com/music/scary-childrens-tunes-dark-ambient-horror-cinematic-halloween-atmosphere-scary-118585/
"credits_theme_1.mp3", //https://pixabay.com/music/modern-classical-simple-piano-melody-9834/
];
const song_files_volume_multilpliers_list = [0.5, 0.5];
count = 0;
for (const file of song_files) {
this.songs[file.split(".")[0]] = new Audio(this.songs_dir + "/" + file);
Expand Down
2 changes: 1 addition & 1 deletion code/src/Engine/Client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Client {
.get(msg.id)
.bodyEntity.getComponent(ComponentTypeEnum.POSITIONPARENT)
);
if (posComp) {
if (posComp && !this.bodyEntities.get(msg.id).is_accending) {
posComp.position.x = msg.x_pos;
posComp.position.y = msg.y_pos;
posComp.position.z = msg.z_pos;
Expand Down
2 changes: 1 addition & 1 deletion code/src/Game/Character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default abstract class Character {
protected trigger_download_needed: boolean;
protected allCharacterDict: object;
protected drag_addition: number = 10;
protected is_accending: boolean;
is_accending: boolean;
accended: boolean;
protected accentionTimerThreshold: number = 4;
protected accention_rotation_base: number = 0.1;
Expand Down
1 change: 0 additions & 1 deletion code/src/Game/PlayerCharacter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default class PlayerCharacter extends Character {
) as ParticleSpawnerComponent;
particleSpawnerComp.destructor();
this.ecsManager.removeEntity(this.bodyEntity.id);
this.audioPlayer.playAudio("credits_theme_1", true);
}

extinguish_audio_operations() {
Expand Down
2 changes: 2 additions & 0 deletions code/src/Game/States/SpectateMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default class SpectateMode extends State {
super.init();
this.game.rendering.camera.setPosition(0, 0, 0);
this.overlay.show();
this.sa.audioPlayer.stopAll();
this.sa.audioPlayer.playAudio("credits_theme_1", true);
}

reset() {
Expand Down
File renamed without changes.
Binary file removed out/Assets/Audio/Songs/theme_1.mp3
Binary file not shown.
1 change: 1 addition & 0 deletions out/Assets/placements/Placements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Placement:Candle
-19.72,-3.17,9.76|0.171,0.171,0.171|0,229,0|0,0,0|XYZ
-31.77,-2.9,11.96|0.171,0.171,0.171|0,229,0|0,0,0|XYZ
-2.98,-3.1,22.54|0.171,0.171,0.171|0,229,0|0,0,0|XYZ
9.39,-3.55,31.17|0.171,0.171,0.171|0,229,0|0,0,0|XYZ
Placement:Gravestone 1
-9.14,-3.24,-0.39|0.292,0.292,0.292|0,0,0|0,0,0|XYZ
-15.16,-3.22,-21.88|0.299,0.299,0.299|0,-22,0|0,0,0|XYZ
Expand Down

0 comments on commit 27d1ec6

Please sign in to comment.