- The range and volume of sounds emitted by StatusEffects can be changed and they can be set to loop.

- StatusEffect sounds are configured as child elements of the StatusEffect (instead of attributes).
- Background sprites can emit sounds.
This commit is contained in:
Joonas Rikkonen
2017-08-24 19:56:31 +03:00
parent 7186a8010a
commit 4bdbf05875
23 changed files with 218 additions and 112 deletions
@@ -53,8 +53,30 @@ namespace Barotrauma
{
this.ParticleEmitter = new ParticleEmitter(prefab.ParticleEmitterPrefab);
}
#endif
if (prefab.SoundElement != null)
{
Sound = Sound.Load(prefab.SoundElement, true);
}
#endif
}
public Vector2 LocalToWorld(Vector2 localPosition, float swingState = 0.0f)
{
Vector2 emitterPos = localPosition * Scale;
if (Rotation != 0.0f || Prefab.SwingAmount != 0.0f)
{
float rot = Rotation + swingState * Prefab.SwingAmount;
var ca = (float)Math.Cos(rot);
var sa = (float)Math.Sin(rot);
emitterPos = new Vector2(
ca * emitterPos.X + sa * emitterPos.Y,
-sa * emitterPos.X + ca * emitterPos.Y);
}
return new Vector2(Position.X, Position.Y) + emitterPos;
}
}