Timer for deattaching items, more reliable door syncing, some new splash sounds

This commit is contained in:
Regalis
2016-02-13 21:25:59 +02:00
parent 9b5e78fce4
commit 9b6dd5da00
30 changed files with 252 additions and 59 deletions
+20 -2
View File
@@ -10,11 +10,13 @@ using System.Collections.Generic;
namespace Barotrauma
{
public enum DamageSoundType {
public enum DamageSoundType
{
None,
StructureBlunt, StructureSlash,
LimbBlunt, LimbSlash, LimbArmor,
Implode, Pressure }
Implode, Pressure
}
public struct DamageSound
{
@@ -53,6 +55,8 @@ namespace Barotrauma
{
public static Sound[] flowSounds = new Sound[3];
public static Sound[] SplashSounds = new Sound[10];
public static float MusicVolume = 1.0f;
private const float MusicLerpSpeed = 0.1f;
@@ -60,6 +64,7 @@ namespace Barotrauma
private static Sound[] waterAmbiences = new Sound[2];
private static int[] waterAmbienceIndexes = new int[2];
private static DamageSound[] damageSounds;
private static BackgroundMusic currentMusic;
@@ -97,6 +102,12 @@ namespace Barotrauma
flowSounds[2] = Sound.Load("Content/Sounds/Water/FlowLarge.ogg", false);
yield return CoroutineStatus.Running;
for (int i = 0; i < 10; i++ )
{
SplashSounds[i] = Sound.Load("Content/Sounds/Water/Splash"+(i)+".ogg", false);
yield return CoroutineStatus.Running;
}
XDocument doc = ToolBox.TryLoadXml("Content/Sounds/sounds.xml");
if (doc == null) yield return CoroutineStatus.Failure;
@@ -282,6 +293,13 @@ namespace Barotrauma
}
}
public static void PlaySplashSound(Vector2 worldPosition, float strength)
{
int splashIndex = MathHelper.Clamp((int)(strength + Rand.Range(-2,2)), 0, SplashSounds.Length-1);
SplashSounds[splashIndex].Play(1.0f, 800.0f, worldPosition);
}
public static void PlayDamageSound(DamageSoundType damageType, float damage, PhysicsBody body)
{
Vector2 bodyPosition = body.DrawPosition;