low pass filter to sounds playing at distance, "armored" limbs, moved playing damagesounds from attack to IDamageable

This commit is contained in:
Regalis
2015-06-01 22:20:17 +03:00
parent 95c0d41023
commit 1f42e4a4db
32 changed files with 331 additions and 175 deletions

View File

@@ -97,7 +97,7 @@ namespace Subsurface
{
distFactor = 1.0f - Vector2.Distance(limb.SimPosition, position)/range;
c.AddDamage(limb.SimPosition, damage * distFactor, 0.0f, stun * distFactor);
c.AddDamage(limb.SimPosition, DamageType.None, damage * distFactor, 0.0f, stun * distFactor);
if (force>0.0f)
{

View File

@@ -214,24 +214,13 @@ namespace Subsurface
soundVolume = soundVolume + ((flowForce.Length() < 100.0f) ? -deltaTime * 0.5f : deltaTime * 0.5f);
soundVolume = MathHelper.Clamp(soundVolume, 0.0f, 1.0f);
//if (soundVolume < 0.01f)
//{
// if (soundIndex > -1)
// {
// Sound.Stop(soundIndex);
// soundIndex = -1;
// }
int index = (int)Math.Floor(flowForce.Length() / 100.0f);
index = Math.Min(index,2);
//}
//else
{
int index = (int)Math.Floor(flowForce.Length() / 100.0f);
index = Math.Min(index,2);
soundIndex = AmbientSoundManager.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f);
//soundVolume = Math.Max(0.0f, soundVolume-deltaTime);
//Sound.UpdatePosition(soundIndex, Position, 2000.0f);
}
soundIndex = AmbientSoundManager.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f);
//soundVolume = Math.Max(0.0f, soundVolume-deltaTime);
//Sound.UpdatePosition(soundIndex, Position, 2000.0f);
flowForce = Vector2.Zero;
@@ -386,7 +375,7 @@ namespace Subsurface
{
float delta = Math.Min(hull2.Volume - hull2.FullVolume + Hull.MaxCompress / 2.0f, deltaTime * 8000.0f * sizeModifier);
flowForce = new Vector2(0.0f, Math.Min(hull2.Pressure-hull1.Pressure,500.0f));
flowForce = new Vector2(0.0f, Math.Min(hull2.Pressure - hull1.Pressure, 500.0f));
delta = Math.Max(delta, 0.0f);
hull1.Volume += delta;
@@ -444,6 +433,7 @@ namespace Subsurface
//}
}
}
if (open > 0.0f)
{
if (hull1.Volume>hull1.FullVolume && hull2.Volume>hull2.FullVolume)
@@ -458,9 +448,6 @@ namespace Subsurface
hull2.LethalPressure = 0.0f;
}
}
}
void UpdateRoomToOut(float deltaTime)
@@ -526,7 +513,7 @@ namespace Subsurface
}
else
{
flowForce = new Vector2(0.0f,delta);
flowForce = new Vector2(0.0f, delta);
}
}
}
@@ -539,9 +526,9 @@ namespace Subsurface
float totalOxygen = hull1.Oxygen + hull2.Oxygen;
float totalVolume = (hull1.FullVolume + hull2.FullVolume);
hull1.Oxygen += Math.Sign(totalOxygen*hull1.FullVolume/(totalVolume) - hull1.Oxygen) * Hull.OxygenDistributionSpeed;
hull2.Oxygen += Math.Sign(totalOxygen*hull2.FullVolume/(totalVolume) - hull2.Oxygen) * Hull.OxygenDistributionSpeed;
hull1.Oxygen += Math.Sign(totalOxygen * hull1.FullVolume / (totalVolume) - hull1.Oxygen) * Hull.OxygenDistributionSpeed;
hull2.Oxygen += Math.Sign(totalOxygen * hull2.FullVolume / (totalVolume) - hull2.Oxygen) * Hull.OxygenDistributionSpeed;
}
public override void Remove()

View File

@@ -14,6 +14,6 @@ namespace Subsurface
get;
}
void AddDamage(Vector2 position, float amount, float bleedingAmount, float stun);
void AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound=true);
}
}

View File

@@ -378,7 +378,7 @@ namespace Subsurface
sections[sectionIndex].rect.Y - sections[sectionIndex].rect.Height / 2.0f);
}
public void AddDamage(Vector2 position, float amount, float bleedingAmount, float stun)
public void AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound = false)
{
if (!prefab.HasBody || prefab.IsPlatform) return;
@@ -387,6 +387,11 @@ namespace Subsurface
Game1.particleManager.CreateParticle("dustcloud", ConvertUnits.ToSimUnits(SectionPosition(i)), 0.0f, 0.0f);
if (playSound)
{
DamageSoundType damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.StructureBlunt : DamageSoundType.StructureSlash;
AmbientSoundManager.PlayDamageSound(damageSoundType, amount, position);
}
AddDamage(i, amount);
}