From 0cb5f5c50a8b83d45e1b37a56ee5d7b7d79d9500 Mon Sep 17 00:00:00 2001 From: yvt Date: Mon, 23 Sep 2013 01:36:30 +0900 Subject: [PATCH] Added a sound layer for SMG --- Resources/Scripts/Skin/SMG/ThirdPerson.as | 15 +++++++++++++++ Resources/Scripts/Skin/SMG/View.as | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Resources/Scripts/Skin/SMG/ThirdPerson.as b/Resources/Scripts/Skin/SMG/ThirdPerson.as index 458a2050..0abcf3bb 100644 --- a/Resources/Scripts/Skin/SMG/ThirdPerson.as +++ b/Resources/Scripts/Skin/SMG/ThirdPerson.as @@ -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() { diff --git a/Resources/Scripts/Skin/SMG/View.as b/Resources/Scripts/Skin/SMG/View.as index cf3c9420..a055c06f 100644 --- a/Resources/Scripts/Skin/SMG/View.as +++ b/Resources/Scripts/Skin/SMG/View.as @@ -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); } }