Added a sound layer for SMG
This commit is contained in:
parent
f08393b475
commit
0cb5f5c50a
@ -84,6 +84,7 @@
|
|||||||
private AudioChunk@ fireSound;
|
private AudioChunk@ fireSound;
|
||||||
private AudioChunk@ fireFarSound;
|
private AudioChunk@ fireFarSound;
|
||||||
private AudioChunk@ fireStereoSound;
|
private AudioChunk@ fireStereoSound;
|
||||||
|
private AudioChunk@[] fireMechSounds(4);
|
||||||
private AudioChunk@ reloadSound;
|
private AudioChunk@ reloadSound;
|
||||||
|
|
||||||
ThirdPersonSMGSkin(Renderer@ r, AudioDevice@ dev) {
|
ThirdPersonSMGSkin(Renderer@ r, AudioDevice@ dev) {
|
||||||
@ -101,6 +102,15 @@
|
|||||||
("Sounds/Weapons/SMG/FireStereo.wav");
|
("Sounds/Weapons/SMG/FireStereo.wav");
|
||||||
@reloadSound = dev.RegisterSound
|
@reloadSound = dev.RegisterSound
|
||||||
("Sounds/Weapons/SMG/Reload.wav");
|
("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) {
|
void Update(float dt) {
|
||||||
@ -116,6 +126,11 @@
|
|||||||
param.volume = 1.f;
|
param.volume = 1.f;
|
||||||
audioDevice.Play(fireFarSound, origin, param);
|
audioDevice.Play(fireFarSound, origin, param);
|
||||||
audioDevice.Play(fireStereoSound, 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() {
|
void ReloadingWeapon() {
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
private AudioChunk@ fireSound;
|
private AudioChunk@ fireSound;
|
||||||
private AudioChunk@ fireFarSound;
|
private AudioChunk@ fireFarSound;
|
||||||
private AudioChunk@ fireStereoSound;
|
private AudioChunk@ fireStereoSound;
|
||||||
|
private AudioChunk@[] fireMechSounds(4);
|
||||||
private AudioChunk@ reloadSound;
|
private AudioChunk@ reloadSound;
|
||||||
|
|
||||||
ViewSMGSkin(Renderer@ r, AudioDevice@ dev) {
|
ViewSMGSkin(Renderer@ r, AudioDevice@ dev) {
|
||||||
@ -49,6 +50,15 @@
|
|||||||
("Sounds/Weapons/SMG/FireStereo.wav");
|
("Sounds/Weapons/SMG/FireStereo.wav");
|
||||||
@reloadSound = dev.RegisterSound
|
@reloadSound = dev.RegisterSound
|
||||||
("Sounds/Weapons/SMG/ReloadLocal.wav");
|
("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) {
|
void Update(float dt) {
|
||||||
@ -67,6 +77,11 @@
|
|||||||
param.volume = 1.f;
|
param.volume = 1.f;
|
||||||
audioDevice.PlayLocal(fireFarSound, origin, param);
|
audioDevice.PlayLocal(fireFarSound, origin, param);
|
||||||
audioDevice.PlayLocal(fireStereoSound, origin, param);
|
audioDevice.PlayLocal(fireStereoSound, origin, param);
|
||||||
|
|
||||||
|
AudioChunk@ mechSound;
|
||||||
|
@mechSound = fireMechSounds[GetRandom(fireMechSounds.length)];
|
||||||
|
param.volume = 1.4;
|
||||||
|
audioDevice.PlayLocal(mechSound, origin, param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user