Added a sound layer for SMG

This commit is contained in:
yvt 2013-09-23 01:36:30 +09:00
parent f08393b475
commit 0cb5f5c50a
2 changed files with 30 additions and 0 deletions

View File

@ -84,6 +84,7 @@
private AudioChunk@ fireSound;
private AudioChunk@ fireFarSound;
private AudioChunk@ fireStereoSound;
private AudioChunk@[] fireMechSounds(4);
private AudioChunk@ reloadSound;
ThirdPersonSMGSkin(Renderer@ r, AudioDevice@ dev) {
@ -101,6 +102,15 @@
("Sounds/Weapons/SMG/FireStereo.wav");
@reloadSound = dev.RegisterSound
("Sounds/Weapons/SMG/Reload.wav");
@fireMechSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech1.wav");
@fireMechSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech2.wav");
@fireMechSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech3.wav");
@fireMechSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech4.wav");
}
void Update(float dt) {
@ -116,6 +126,11 @@
param.volume = 1.f;
audioDevice.Play(fireFarSound, origin, param);
audioDevice.Play(fireStereoSound, origin, param);
AudioChunk@ mechSound;
@mechSound = fireMechSounds[GetRandom(fireMechSounds.length)];
param.volume = 1.4;
audioDevice.PlayLocal(mechSound, origin, param);
}
}
void ReloadingWeapon() {

View File

@ -31,6 +31,7 @@
private AudioChunk@ fireSound;
private AudioChunk@ fireFarSound;
private AudioChunk@ fireStereoSound;
private AudioChunk@[] fireMechSounds(4);
private AudioChunk@ reloadSound;
ViewSMGSkin(Renderer@ r, AudioDevice@ dev) {
@ -49,6 +50,15 @@
("Sounds/Weapons/SMG/FireStereo.wav");
@reloadSound = dev.RegisterSound
("Sounds/Weapons/SMG/ReloadLocal.wav");
@fireMechSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech1.wav");
@fireMechSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech2.wav");
@fireMechSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech3.wav");
@fireMechSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech4.wav");
}
void Update(float dt) {
@ -67,6 +77,11 @@
param.volume = 1.f;
audioDevice.PlayLocal(fireFarSound, origin, param);
audioDevice.PlayLocal(fireStereoSound, origin, param);
AudioChunk@ mechSound;
@mechSound = fireMechSounds[GetRandom(fireMechSounds.length)];
param.volume = 1.4;
audioDevice.PlayLocal(mechSound, origin, param);
}
}