2026-03-19 20:10:45 +01:00
|
|
|
using System;
|
|
|
|
|
using GlobalClassLib;
|
|
|
|
|
using Microsoft.Xna.Framework.Audio;
|
|
|
|
|
using MonoGameLibrary;
|
2026-03-28 09:59:31 +01:00
|
|
|
using ONDClient.Enemies;
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-28 09:59:31 +01:00
|
|
|
namespace ONDClient.Sound;
|
2026-03-19 20:10:45 +01:00
|
|
|
|
|
|
|
|
public static class SoundManager {
|
|
|
|
|
private static SoundEffect ambience;
|
|
|
|
|
private static SoundEffect ventWalk;
|
|
|
|
|
private static SoundEffect camSwitch;
|
|
|
|
|
private static SoundEffect lightOff;
|
|
|
|
|
private static SoundEffect lightOn;
|
|
|
|
|
private static SoundEffect doorClose;
|
|
|
|
|
private static SoundEffect doorCloseRemote;
|
|
|
|
|
private static SoundEffect doorOpen;
|
|
|
|
|
private static SoundEffect doorOpenRemote;
|
|
|
|
|
private static SoundEffect monitorFlip;
|
|
|
|
|
private static SoundEffect powerOut;
|
|
|
|
|
private static SoundEffect mareMove;
|
|
|
|
|
private static SoundEffect dashMove;
|
|
|
|
|
private static SoundEffect spotMove;
|
|
|
|
|
private static SoundEffect spotActivate;
|
|
|
|
|
private static SoundEffect nekoPurr;
|
|
|
|
|
private static SoundEffect jumpscare;
|
|
|
|
|
private static SoundEffect nekoAnger;
|
|
|
|
|
private static SoundEffect nekoMove;
|
2026-03-19 21:18:06 +01:00
|
|
|
private static SoundEffect bell;
|
2026-03-19 20:10:45 +01:00
|
|
|
|
|
|
|
|
private static SoundEffectInstance ambienceInstance;
|
|
|
|
|
private static SoundEffectInstance nekoPurrInstance;
|
|
|
|
|
|
|
|
|
|
private static Random random = new();
|
|
|
|
|
|
|
|
|
|
public static void LoadSounds() {
|
|
|
|
|
ambience = Core.content.Load<SoundEffect>("sounds/ambience");
|
|
|
|
|
ventWalk = Core.content.Load<SoundEffect>("sounds/vent-walk");
|
|
|
|
|
camSwitch = Core.content.Load<SoundEffect>("sounds/camera-switch");
|
|
|
|
|
lightOff = Core.content.Load<SoundEffect>("sounds/light-off");
|
|
|
|
|
lightOn = Core.content.Load<SoundEffect>("sounds/light-on");
|
|
|
|
|
doorClose = Core.content.Load<SoundEffect>("sounds/door-close");
|
|
|
|
|
doorCloseRemote = Core.content.Load<SoundEffect>("sounds/door-close-remote");
|
|
|
|
|
doorOpen = Core.content.Load<SoundEffect>("sounds/door-open");
|
|
|
|
|
doorOpenRemote = Core.content.Load<SoundEffect>("sounds/door-open-remote");
|
|
|
|
|
monitorFlip = Core.content.Load<SoundEffect>("sounds/monitor-flip");
|
|
|
|
|
powerOut = Core.content.Load<SoundEffect>("sounds/powerout");
|
|
|
|
|
mareMove = Core.content.Load<SoundEffect>("sounds/mare-move");
|
|
|
|
|
dashMove = Core.content.Load<SoundEffect>("sounds/dash-move");
|
|
|
|
|
spotMove = Core.content.Load<SoundEffect>("sounds/spot-move");
|
|
|
|
|
spotActivate = Core.content.Load<SoundEffect>("sounds/spot-activate");
|
|
|
|
|
nekoPurr = Core.content.Load<SoundEffect>("sounds/neko-purr");
|
|
|
|
|
jumpscare = Core.content.Load<SoundEffect>("sounds/jumpscare");
|
|
|
|
|
nekoAnger = Core.content.Load<SoundEffect>("sounds/neko-angry");
|
|
|
|
|
nekoMove = Core.content.Load<SoundEffect>("sounds/neko-move1");
|
2026-03-19 21:18:06 +01:00
|
|
|
bell = Core.content.Load<SoundEffect>("sounds/bell");
|
|
|
|
|
|
2026-03-19 20:10:45 +01:00
|
|
|
ambienceInstance = ambience.CreateInstance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void StartAmbience() {
|
|
|
|
|
ambienceInstance = ambience.CreateInstance();
|
|
|
|
|
ambienceInstance.IsLooped = true;
|
|
|
|
|
ambienceInstance.Volume = 0.75f;
|
|
|
|
|
ambienceInstance.Play();
|
|
|
|
|
}
|
|
|
|
|
public static void StopAmbience() {
|
|
|
|
|
ambienceInstance.Stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PlayDoor(bool doorState) {
|
|
|
|
|
if (doorState){
|
2026-03-29 18:15:32 +02:00
|
|
|
GetRandomisedPitchInstance(doorClose).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
|
|
|
|
else{
|
2026-03-29 18:15:32 +02:00
|
|
|
GetRandomisedPitchInstance(doorOpen).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static void PlayDoorRemote(bool doorState) {
|
|
|
|
|
if (doorState){
|
2026-03-29 18:15:32 +02:00
|
|
|
GetRandomisedPitchInstance(doorCloseRemote).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
|
|
|
|
else{
|
2026-03-29 18:15:32 +02:00
|
|
|
GetRandomisedPitchInstance(doorOpenRemote).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PlayLight(bool lightState) {
|
|
|
|
|
if (lightState){
|
2026-03-29 18:15:32 +02:00
|
|
|
GetRandomisedPitchInstance(lightOn).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
|
|
|
|
else{
|
2026-03-29 18:15:32 +02:00
|
|
|
GetRandomisedPitchInstance(lightOff).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PlayJumpscare() => jumpscare.Play();
|
|
|
|
|
|
|
|
|
|
public static void PlayPowerOut() => powerOut.Play();
|
|
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlayNekoMove() => GetRandomisedPitchInstance(nekoMove).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
|
|
|
|
public static void PlayNekoAnger() => nekoAnger.Play();
|
|
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlaySpotActivate() => GetRandomisedPitchInstance(spotActivate).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlaySpotMove() => GetRandomisedPitchInstance(spotMove).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlayDashMove() => GetRandomisedPitchInstance(dashMove).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlayMareMove() => GetRandomisedPitchInstance(mareMove).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlayMonitorFlip() => GetRandomisedPitchInstance(monitorFlip).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlayCameraSwitch() => GetRandomisedPitchInstance(camSwitch).Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
2026-03-29 18:15:32 +02:00
|
|
|
public static void PlayVentWalk() => GetRandomisedPitchInstance(ventWalk).Play();
|
2026-03-19 21:18:06 +01:00
|
|
|
|
|
|
|
|
public static void PlayBell() => bell.Play();
|
2026-03-19 20:10:45 +01:00
|
|
|
|
|
|
|
|
public static void StartNekoPurr() {
|
2026-03-30 19:55:25 +02:00
|
|
|
nekoPurrInstance?.Stop();
|
2026-03-19 20:10:45 +01:00
|
|
|
nekoPurrInstance = nekoPurr.CreateInstance();
|
|
|
|
|
nekoPurrInstance.IsLooped = true;
|
|
|
|
|
nekoPurrInstance.Play();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void StopNekoPurr() {
|
2026-03-29 18:15:32 +02:00
|
|
|
nekoPurrInstance?.Stop();
|
2026-03-19 20:10:45 +01:00
|
|
|
}
|
2026-03-29 18:15:32 +02:00
|
|
|
|
2026-03-19 20:10:45 +01:00
|
|
|
private static SoundEffectInstance GetRandomisedPitchInstance(SoundEffect effect) {
|
|
|
|
|
SoundEffectInstance instance = effect.CreateInstance();
|
|
|
|
|
instance.Pitch = (float)(random.NextDouble() - 0.5) / 5;
|
|
|
|
|
instance.Play();
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PlayEnemyMove(ClientEnemy enemy) {
|
2026-03-28 09:59:31 +01:00
|
|
|
switch (enemy.Type){
|
2026-03-19 20:10:45 +01:00
|
|
|
case EnemyType.NEKO:
|
|
|
|
|
PlayNekoMove();
|
|
|
|
|
break;
|
|
|
|
|
case EnemyType.SPOT:
|
|
|
|
|
PlaySpotMove();
|
|
|
|
|
break;
|
|
|
|
|
case EnemyType.MARE:
|
|
|
|
|
PlayMareMove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PlayEnemyReset(ClientEnemy enemy) {
|
2026-03-28 09:59:31 +01:00
|
|
|
switch (enemy.Type){
|
2026-03-19 20:10:45 +01:00
|
|
|
case EnemyType.NEKO:
|
|
|
|
|
PlayNekoMove();
|
|
|
|
|
break;
|
|
|
|
|
case EnemyType.SPOT:
|
|
|
|
|
PlaySpotMove();
|
|
|
|
|
break;
|
|
|
|
|
case EnemyType.MARE:
|
|
|
|
|
PlayMareMove();
|
|
|
|
|
break;
|
|
|
|
|
case EnemyType.DASH:
|
|
|
|
|
PlayDashMove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|