- 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:
@@ -70,9 +70,9 @@
|
|||||||
<Compile Include="Source\Characters\AI\HumanAIController.cs" />
|
<Compile Include="Source\Characters\AI\HumanAIController.cs" />
|
||||||
<Compile Include="Source\Characters\Animation\Ragdoll.cs" />
|
<Compile Include="Source\Characters\Animation\Ragdoll.cs" />
|
||||||
<Compile Include="Source\Characters\Attack.cs" />
|
<Compile Include="Source\Characters\Attack.cs" />
|
||||||
<Compile Include="Source\Characters\BackgroundSprite\BackgroundCreature.cs" />
|
<Compile Include="Source\Map\Levels\BackgroundSprite\BackgroundCreature.cs" />
|
||||||
<Compile Include="Source\Characters\BackgroundSprite\BackgroundCreatureManager.cs" />
|
<Compile Include="Source\Map\Levels\BackgroundSprite\BackgroundCreatureManager.cs" />
|
||||||
<Compile Include="Source\Characters\BackgroundSprite\BackgroundCreaturePrefab.cs" />
|
<Compile Include="Source\Map\Levels\BackgroundSprite\BackgroundCreaturePrefab.cs" />
|
||||||
<Compile Include="Source\Characters\Character.cs" />
|
<Compile Include="Source\Characters\Character.cs" />
|
||||||
<Compile Include="Source\Characters\CharacterHUD.cs" />
|
<Compile Include="Source\Characters\CharacterHUD.cs" />
|
||||||
<Compile Include="Source\Characters\CharacterInfo.cs" />
|
<Compile Include="Source\Characters\CharacterInfo.cs" />
|
||||||
@@ -151,8 +151,8 @@
|
|||||||
<Compile Include="Source\Map\FireSource.cs" />
|
<Compile Include="Source\Map\FireSource.cs" />
|
||||||
<Compile Include="Source\Map\Gap.cs" />
|
<Compile Include="Source\Map\Gap.cs" />
|
||||||
<Compile Include="Source\Map\Hull.cs" />
|
<Compile Include="Source\Map\Hull.cs" />
|
||||||
<Compile Include="Source\Map\Levels\BackgroundSpriteManager.cs" />
|
<Compile Include="Source\Map\Levels\BackgroundSprite\BackgroundSpriteManager.cs" />
|
||||||
<Compile Include="Source\Map\Levels\BackgroundSpritePrefab.cs" />
|
<Compile Include="Source\Map\Levels\BackgroundSprite\BackgroundSpritePrefab.cs" />
|
||||||
<Compile Include="Source\Map\Levels\CaveGenerator.cs" />
|
<Compile Include="Source\Map\Levels\CaveGenerator.cs" />
|
||||||
<Compile Include="Source\Map\Levels\Level.cs" />
|
<Compile Include="Source\Map\Levels\Level.cs" />
|
||||||
<Compile Include="Source\Map\Levels\LevelRenderer.cs" />
|
<Compile Include="Source\Map\Levels\LevelRenderer.cs" />
|
||||||
|
|||||||
+15
-11
@@ -9,6 +9,7 @@ namespace Barotrauma
|
|||||||
partial class BackgroundSprite
|
partial class BackgroundSprite
|
||||||
{
|
{
|
||||||
public ParticleEmitter ParticleEmitter;
|
public ParticleEmitter ParticleEmitter;
|
||||||
|
public Sound Sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
partial class BackgroundSpriteManager
|
partial class BackgroundSpriteManager
|
||||||
@@ -21,21 +22,24 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
foreach (BackgroundSprite s in visibleSprites)
|
foreach (BackgroundSprite s in visibleSprites)
|
||||||
{
|
{
|
||||||
if (s.Prefab.ParticleEmitterPrefab != null)
|
if (s.ParticleEmitter != null)
|
||||||
{
|
{
|
||||||
Vector2 emitterPos = new Vector2(s.Prefab.EmitterPosition.X, s.Prefab.EmitterPosition.Y) * s.Scale;
|
Vector2 emitterPos = s.LocalToWorld(new Vector2(s.Prefab.EmitterPosition.X, s.Prefab.EmitterPosition.Y));
|
||||||
|
s.ParticleEmitter.Emit(deltaTime, emitterPos);
|
||||||
|
}
|
||||||
|
|
||||||
if (s.Rotation != 0.0f || s.Prefab.SwingAmount != 0.0f)
|
if (s.Sound != null)
|
||||||
|
{
|
||||||
|
int sourceIndex;
|
||||||
|
Vector2 soundPos = s.LocalToWorld(new Vector2(s.Prefab.SoundPosition.X, s.Prefab.SoundPosition.Y));
|
||||||
|
if (!Sounds.SoundManager.IsPlaying(s.Sound, out sourceIndex))
|
||||||
{
|
{
|
||||||
var ca = (float)Math.Cos(s.Rotation + swingState * s.Prefab.SwingAmount);
|
s.Sound.Play(soundPos);
|
||||||
var sa = (float)Math.Sin(s.Rotation + swingState * s.Prefab.SwingAmount);
|
}
|
||||||
|
else
|
||||||
emitterPos = new Vector2(
|
{
|
||||||
ca * emitterPos.X + sa * emitterPos.Y,
|
s.Sound.UpdatePosition(soundPos);
|
||||||
-sa * emitterPos.X + ca * emitterPos.Y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s.ParticleEmitter.Emit(deltaTime, new Vector2(s.Position.X, s.Position.Y) + emitterPos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -6,5 +7,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public readonly Particles.ParticleEmitterPrefab ParticleEmitterPrefab;
|
public readonly Particles.ParticleEmitterPrefab ParticleEmitterPrefab;
|
||||||
public readonly Vector2 EmitterPosition;
|
public readonly Vector2 EmitterPosition;
|
||||||
|
|
||||||
|
public readonly XElement SoundElement;
|
||||||
|
public readonly Vector2 SoundPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -17,17 +18,21 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private OggSound oggSound;
|
private OggSound oggSound;
|
||||||
|
|
||||||
string filePath;
|
private readonly string filePath;
|
||||||
|
private readonly bool destroyOnGameEnd;
|
||||||
|
|
||||||
|
private float baseVolume;
|
||||||
|
private float range;
|
||||||
|
|
||||||
private int alSourceId;
|
private int alSourceId;
|
||||||
|
|
||||||
private bool destroyOnGameEnd;
|
|
||||||
|
|
||||||
|
|
||||||
//public float Volume
|
public bool IsPlaying
|
||||||
//{
|
{
|
||||||
// set { SoundManager.Volume(sourceIndex, value); }
|
get
|
||||||
//}
|
{
|
||||||
|
return SoundManager.IsPlaying(alSourceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Sound(string file, bool destroyOnGameEnd)
|
private Sound(string file, bool destroyOnGameEnd)
|
||||||
{
|
{
|
||||||
@@ -52,11 +57,14 @@ namespace Barotrauma
|
|||||||
ALHelper.Check();
|
ALHelper.Check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
baseVolume = 1.0f;
|
||||||
|
range = 1000.0f;
|
||||||
|
|
||||||
this.destroyOnGameEnd = destroyOnGameEnd;
|
this.destroyOnGameEnd = destroyOnGameEnd;
|
||||||
|
|
||||||
loadedSounds.Add(this);
|
loadedSounds.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FilePath
|
public string FilePath
|
||||||
{
|
{
|
||||||
get { return filePath; }
|
get { return filePath; }
|
||||||
@@ -83,6 +91,20 @@ namespace Barotrauma
|
|||||||
return new Sound(file, destroyOnGameEnd);
|
return new Sound(file, destroyOnGameEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Sound Load(XElement element, bool destroyOnGameEnd = true)
|
||||||
|
{
|
||||||
|
string filePath = ToolBox.GetAttributeString(element, "file", "");
|
||||||
|
|
||||||
|
var newSound = new Sound(filePath, destroyOnGameEnd);
|
||||||
|
if (newSound != null)
|
||||||
|
{
|
||||||
|
newSound.baseVolume = ToolBox.GetAttributeFloat(element, "volume", 1.0f);
|
||||||
|
newSound.range = ToolBox.GetAttributeFloat(element, "range", 1000.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newSound;
|
||||||
|
}
|
||||||
|
|
||||||
public int Play(float volume = 1.0f)
|
public int Play(float volume = 1.0f)
|
||||||
{
|
{
|
||||||
if (volume <= 0.0f) return -1;
|
if (volume <= 0.0f) return -1;
|
||||||
@@ -91,77 +113,53 @@ namespace Barotrauma
|
|||||||
return alSourceId;
|
return alSourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Play(Vector2 position)
|
||||||
|
{
|
||||||
|
return Play(baseVolume, range, position);
|
||||||
|
}
|
||||||
|
|
||||||
public int Play(float baseVolume, float range, Vector2 position)
|
public int Play(float baseVolume, float range, Vector2 position)
|
||||||
{
|
{
|
||||||
//position = new Vector2(position.X - CameraPos.X, position.Y - CameraPos.Y);
|
|
||||||
|
|
||||||
//volume = (range == 0.0f) ? 0.0f : MathHelper.Clamp(volume * (range - position.Length())/range, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
Vector2 relativePos = GetRelativePosition(position);
|
Vector2 relativePos = GetRelativePosition(position);
|
||||||
float volume = GetVolume(relativePos, range, baseVolume);
|
float volume = GetVolume(relativePos, range, baseVolume);
|
||||||
|
|
||||||
if (volume <= 0.0f) return -1;
|
if (volume <= 0.0f) return -1;
|
||||||
|
|
||||||
alSourceId = SoundManager.Play(this, relativePos/100.0f, volume);
|
alSourceId = SoundManager.Play(this, relativePos, volume);
|
||||||
|
|
||||||
return alSourceId;
|
return alSourceId;
|
||||||
|
|
||||||
//if (newIndex == -1) return -1;
|
|
||||||
|
|
||||||
//return UpdatePosition(newIndex, position, range, volume);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public int Play(float volume, float range, Body body)
|
public void UpdatePosition(Vector2 position)
|
||||||
//{
|
{
|
||||||
// //Vector2 bodyPosition = ConvertUnits.ToDisplayUnits(body.Position);
|
int sourceIndex = -1;
|
||||||
// //bodyPosition.Y = -bodyPosition.Y;
|
if (SoundManager.IsPlaying(this, out sourceIndex))
|
||||||
|
{
|
||||||
|
Vector2 relativePos = GetRelativePosition(position);
|
||||||
// alSourceId = Play(volume, range, ConvertUnits.ToDisplayUnits(body.Position));
|
float volume = GetVolume(relativePos, range, baseVolume);
|
||||||
|
|
||||||
// return alSourceId;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
if (volume <= 0.0f)
|
||||||
|
{
|
||||||
|
SoundManager.Stop(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SoundManager.UpdateSoundPosition(sourceIndex, relativePos, volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private float GetVolume(Vector2 relativePosition, float range, float baseVolume)
|
private float GetVolume(Vector2 relativePosition, float range, float baseVolume)
|
||||||
{
|
{
|
||||||
float volume = (range == 0.0f) ? 0.0f : MathHelper.Clamp(baseVolume * (range - relativePosition.Length()) / range, 0.0f, 1.0f);
|
float volume = (range == 0.0f) ? 0.0f : MathHelper.Clamp(baseVolume * (range - (relativePosition.Length() * 100.0f)) / range, 0.0f, 1.0f);
|
||||||
|
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 GetRelativePosition(Vector2 position)
|
private Vector2 GetRelativePosition(Vector2 position)
|
||||||
{
|
{
|
||||||
return new Vector2(position.X - CameraPos.X, position.Y - CameraPos.Y);
|
return new Vector2(position.X - CameraPos.X, position.Y - CameraPos.Y) / 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static int UpdatePosition(int sourceIndex, Vector2 position, float range, float baseVolume = 1.0f)
|
|
||||||
//{
|
|
||||||
// position = new Vector2(position.X - CameraPos.X, position.Y - CameraPos.Y);
|
|
||||||
// float volume = (range == 0.0f) ? 0.0f : MathHelper.Clamp(baseVolume * (range - position.Length())/range, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
// if (volume <= 0.0f)
|
|
||||||
// {
|
|
||||||
// if (sourceIndex > 0)
|
|
||||||
// {
|
|
||||||
// SoundManager.Stop(sourceIndex);
|
|
||||||
// sourceIndex = -1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return sourceIndex;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// SoundManager.UpdateSoundPosition(sourceIndex, position, volume, volume);
|
|
||||||
|
|
||||||
// return sourceIndex;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public int UpdatePosition(int sourceIndex, Body body, float range, float baseVolume = 1.0f)
|
|
||||||
//{
|
|
||||||
// Vector2 bodyPosition = ConvertUnits.ToDisplayUnits(body.Position);
|
|
||||||
// bodyPosition.Y = -bodyPosition.Y;
|
|
||||||
// return UpdatePosition(sourceIndex, bodyPosition, range, baseVolume);
|
|
||||||
//}
|
|
||||||
|
|
||||||
public int Loop(int sourceIndex, float volume)
|
public int Loop(int sourceIndex, float volume)
|
||||||
{
|
{
|
||||||
if (volume <= 0.0f)
|
if (volume <= 0.0f)
|
||||||
@@ -196,18 +194,10 @@ namespace Barotrauma
|
|||||||
return sourceIndex;
|
return sourceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
alSourceId = SoundManager.Loop(this, sourceIndex, relativePos / 100.0f, volume);
|
alSourceId = SoundManager.Loop(this, sourceIndex, relativePos, volume);
|
||||||
return alSourceId;
|
return alSourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPlaying
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return SoundManager.IsPlaying(alSourceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void OnGameEnd()
|
public static void OnGameEnd()
|
||||||
{
|
{
|
||||||
List<Sound> removableSounds = loadedSounds.FindAll(s => s.destroyOnGameEnd);
|
List<Sound> removableSounds = loadedSounds.FindAll(s => s.destroyOnGameEnd);
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ namespace Barotrauma.Sounds
|
|||||||
if (Disabled) return;
|
if (Disabled) return;
|
||||||
|
|
||||||
if (sourceIndex < 1) return;
|
if (sourceIndex < 1) return;
|
||||||
|
|
||||||
var state = AL.GetSourceState(alSources[sourceIndex]);
|
var state = AL.GetSourceState(alSources[sourceIndex]);
|
||||||
if (state == ALSourceState.Playing || state == ALSourceState.Paused)
|
if (state == ALSourceState.Playing || state == ALSourceState.Paused)
|
||||||
{
|
{
|
||||||
@@ -195,6 +195,20 @@ namespace Barotrauma.Sounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Stop(Sound sound)
|
||||||
|
{
|
||||||
|
if (Disabled) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < soundsPlaying.Length; i++)
|
||||||
|
{
|
||||||
|
if (soundsPlaying[i] == sound)
|
||||||
|
{
|
||||||
|
Stop(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Sound GetPlayingSound(int sourceIndex)
|
public static Sound GetPlayingSound(int sourceIndex)
|
||||||
{
|
{
|
||||||
if (Disabled) return null;
|
if (Disabled) return null;
|
||||||
@@ -215,6 +229,29 @@ namespace Barotrauma.Sounds
|
|||||||
return AL.GetSourceState(alSources[sourceIndex]) == ALSourceState.Playing;
|
return AL.GetSourceState(alSources[sourceIndex]) == ALSourceState.Playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsPlaying(Sound sound)
|
||||||
|
{
|
||||||
|
int temp;
|
||||||
|
return IsPlaying(sound, out temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsPlaying(Sound sound, out int sourceIndex)
|
||||||
|
{
|
||||||
|
sourceIndex = -1;
|
||||||
|
if (Disabled) return false;
|
||||||
|
|
||||||
|
for (int i = 0; i < soundsPlaying.Length; i++)
|
||||||
|
{
|
||||||
|
if (soundsPlaying[i] == sound && AL.GetSourceState(alSources[i]) == ALSourceState.Playing)
|
||||||
|
{
|
||||||
|
sourceIndex = i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsPaused(int sourceIndex)
|
public static bool IsPaused(int sourceIndex)
|
||||||
{
|
{
|
||||||
if (Disabled) return false;
|
if (Disabled) return false;
|
||||||
|
|||||||
@@ -1228,6 +1228,9 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\UI\UImsg.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\UI\UImsg.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Water\BlackSmoker.ogg">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Water\Drown1.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Water\Drown1.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -103,7 +103,8 @@
|
|||||||
<Holdable slots="Any,RightHand,LeftHand" handle1="0,-5">
|
<Holdable slots="Any,RightHand,LeftHand" handle1="0,-5">
|
||||||
<StatusEffect type="Always" target="Hull" oxygen="5000.0"/>
|
<StatusEffect type="Always" target="Hull" oxygen="5000.0"/>
|
||||||
|
|
||||||
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg"/>
|
||||||
<Explosion range="600.0" structuredamage="400" damage="300" stun="5" force="20.0"/>
|
<Explosion range="600.0" structuredamage="400" damage="300" stun="5" force="20.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
@@ -168,7 +169,8 @@
|
|||||||
<Projectile launchimpulse="80.0">
|
<Projectile launchimpulse="80.0">
|
||||||
<Attack damage="1000" bleedingdamage="10" structuredamage="500" damagetype="Blunt"/>
|
<Attack damage="1000" bleedingdamage="10" structuredamage="500" damagetype="Blunt"/>
|
||||||
|
|
||||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Artifacts/alienweapon.ogg">
|
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Artifacts/alienweapon.ogg"/>
|
||||||
<Explosion range="1000.0" structuredamage="5000" damage="1000" stun="10" force="50.0"/>
|
<Explosion range="1000.0" structuredamage="5000" damage="1000" stun="10" force="50.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
<Body width="12" height="33" density="5"/>
|
<Body width="12" height="33" density="5"/>
|
||||||
|
|
||||||
<Pickable holdpos="30,-15" handle1="0,1" slots="RightHand,LeftHand,Any">
|
<Pickable holdpos="30,-15" handle1="0,1" slots="RightHand,LeftHand,Any">
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg" disabledeltatime="true">
|
<StatusEffect type="OnFire" target="This" Condition="-100.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg"/>
|
||||||
<Explosion range="250.0" structuredamage="10" damage="20" stun="5" force="3.0"/>
|
<Explosion range="250.0" structuredamage="10" damage="20" stun="5" force="3.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Pickable>
|
</Pickable>
|
||||||
@@ -133,7 +134,6 @@
|
|||||||
<RequiredItems name="Battery Cell,Fulgurium Battery Cell" type="Contained" msg="Battery Cell required"/>
|
<RequiredItems name="Battery Cell,Fulgurium Battery Cell" type="Contained" msg="Battery Cell required"/>
|
||||||
<StatusEffect type="OnUse" target="Contained" Condition="-1.0"/>
|
<StatusEffect type="OnUse" target="Contained" Condition="-1.0"/>
|
||||||
<sound file="scooter.ogg" type="OnUse" range="500.0" loop="true"/>
|
<sound file="scooter.ogg" type="OnUse" range="500.0" loop="true"/>
|
||||||
|
|
||||||
<LightComponent LightColor="1.0,1.0,1.0,1.0" Flicker="0.2" range="800">
|
<LightComponent LightColor="1.0,1.0,1.0,1.0" Flicker="0.2" range="800">
|
||||||
<LightTexture texture="Content/Lights/lightcone.png" origin="0.05, 0.5" size="2.0,1.0"/>
|
<LightTexture texture="Content/Lights/lightcone.png" origin="0.05, 0.5" size="2.0,1.0"/>
|
||||||
</LightComponent>
|
</LightComponent>
|
||||||
|
|||||||
@@ -86,7 +86,8 @@
|
|||||||
<Body width="24" height="12" density="60"/>
|
<Body width="24" height="12" density="60"/>
|
||||||
|
|
||||||
<Holdable slots="Any,RightHand,LeftHand" handle1="0,0">
|
<Holdable slots="Any,RightHand,LeftHand" handle1="0,0">
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg"/>
|
||||||
<Explosion range="500.0" structuredamage="2" damage="20" stun="5" force="20.0"/>
|
<Explosion range="500.0" structuredamage="2" damage="20" stun="5" force="20.0"/>
|
||||||
<Fire size="100.0"/>
|
<Fire size="100.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
||||||
aimpos="5,0" handle1="-5,0" holdangle="10" reload="1.0">
|
aimpos="5,0" handle1="-5,0" holdangle="10" reload="1.0">
|
||||||
|
|
||||||
<StatusEffect type="OnUse" target="Contained, Character" Condition="-25.0" disabledeltatime="true" sound="Content/Items/Medical/syringe.ogg">
|
<StatusEffect type="OnUse" target="Contained, Character" Condition="-25.0" disabledeltatime="true" >
|
||||||
|
<sound file="Content/Items/Medical/syringe.ogg" range="500"/>
|
||||||
<RequiredItem name="chem" type="Contained"/>
|
<RequiredItem name="chem" type="Contained"/>
|
||||||
<Use/>
|
<Use/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
@@ -42,8 +43,10 @@
|
|||||||
|
|
||||||
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
||||||
aimpos="5,0" handle1="-5,0" holdangle="10" reload="1.0">
|
aimpos="5,0" handle1="-5,0" holdangle="10" reload="1.0">
|
||||||
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true" sound="Content/Items/Medical/bandage.ogg"/>
|
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/>
|
||||||
<StatusEffect type="OnUse" target="This, Character" bleeding="-0.1" duration="5.0" sound="Content/Items/Medical/bandage.ogg"/>
|
<StatusEffect type="OnUse" target="This, Character" bleeding="-0.1" duration="5.0">
|
||||||
|
<Sound file="Content/Items/Medical/bandage.ogg" range="500"/>
|
||||||
|
</StatusEffect>
|
||||||
</MeleeWeapon>
|
</MeleeWeapon>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
@@ -275,7 +278,8 @@
|
|||||||
|
|
||||||
<Holdable slots="Any,RightHand,LeftHand">
|
<Holdable slots="Any,RightHand,LeftHand">
|
||||||
<StatusEffect type="OnFire" target="this" condition="-50"/>
|
<StatusEffect type="OnFire" target="this" condition="-50"/>
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<Sound file="Content/Items/Reactor/explosion.ogg"/>
|
||||||
<Explosion range="500" damage="5" stun="3" force="0.1"/>
|
<Explosion range="500" damage="5" stun="3" force="0.1"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
<StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" />
|
<StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" />
|
||||||
<sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02" loop="true"/>
|
<sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02" loop="true"/>
|
||||||
|
|
||||||
<StatusEffect type="OnBroken" target="This" FissionRate="0.0" disabledeltatime="true" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" FissionRate="0.0" disabledeltatime="true">
|
||||||
|
<Sound file="Content/Items/Reactor/explosion.ogg" range="5000"/>
|
||||||
<Explosion range ="800" damage="500" structuredamage="400" stun="5.0" force="5.0"/>
|
<Explosion range ="800" damage="500" structuredamage="400" stun="5.0" force="5.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Reactor>
|
</Reactor>
|
||||||
|
|||||||
@@ -117,7 +117,8 @@
|
|||||||
<Body width="12" height="33" density="5"/>
|
<Body width="12" height="33" density="5"/>
|
||||||
|
|
||||||
<Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
|
<Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg" disabledeltatime="true">
|
<StatusEffect type="OnFire" target="This" Condition="-100.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg"/>
|
||||||
<Explosion range="250.0" structuredamage="15" damage="25" stun="5" force="3.0"/>
|
<Explosion range="250.0" structuredamage="15" damage="25" stun="5" force="3.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|||||||
@@ -81,7 +81,8 @@
|
|||||||
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,20" handle2="10,20" aimable="false"/>
|
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,20" handle2="10,20" aimable="false"/>
|
||||||
|
|
||||||
<Projectile launchimpulse="5.0">
|
<Projectile launchimpulse="5.0">
|
||||||
<StatusEffect type="OnImpact" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg">
|
<StatusEffect type="OnImpact" Condition="-100.0" stun="10.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Weapons/bigexplosion.ogg" range="10000"/>
|
||||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
|
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
<StatusEffect type="OnImpact" target="Contained" Condition="-100.0"/>
|
<StatusEffect type="OnImpact" target="Contained" Condition="-100.0"/>
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<Body width="16" height="7"/>
|
<Body width="16" height="7"/>
|
||||||
|
|
||||||
<Pickable slots="Any">
|
<Pickable slots="Any">
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg" range="3000"/>
|
||||||
<Explosion range="500.0" structuredamage="250" damage="200" stun="5" force="20.0" severlimbsprobability="0.5" decal="explosion" decalsize="0.5"/>
|
<Explosion range="500.0" structuredamage="250" damage="200" stun="5" force="20.0" severlimbsprobability="0.5" decal="explosion" decalsize="0.5"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Pickable>
|
</Pickable>
|
||||||
@@ -30,7 +31,8 @@
|
|||||||
|
|
||||||
<Pickable slots="Any">
|
<Pickable slots="Any">
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg" range="3000"/>
|
||||||
<Explosion range="600.0" structuredamage="150" damage="300" stun="5" force="20.0" severlimbsprobability="0.6" decal="explosion" decalsize="0.5"/>
|
<Explosion range="600.0" structuredamage="150" damage="300" stun="5" force="20.0" severlimbsprobability="0.6" decal="explosion" decalsize="0.5"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Pickable>
|
</Pickable>
|
||||||
@@ -49,7 +51,8 @@
|
|||||||
<Pickable slots="Any">
|
<Pickable slots="Any">
|
||||||
<StatusEffect type="Always" target="This" Condition="-0.35"/>
|
<StatusEffect type="Always" target="This" Condition="-0.35"/>
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg" range="3000"/>
|
||||||
<Explosion range="600.0" structuredamage="150" damage="300" stun="5" force="20.0" severlimbsprobability="0.6" decal="explosion" decalsize="0.5"/>
|
<Explosion range="600.0" structuredamage="150" damage="300" stun="5" force="20.0" severlimbsprobability="0.6" decal="explosion" decalsize="0.5"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Pickable>
|
</Pickable>
|
||||||
@@ -68,7 +71,8 @@
|
|||||||
|
|
||||||
<Pickable slots="Any">
|
<Pickable slots="Any">
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg" range="2000"/>
|
||||||
<Explosion range="500.0" structuredamage="50" damage="300" stun="5" force="20.0" severlimbsprobability="0.6"/>
|
<Explosion range="500.0" structuredamage="50" damage="300" stun="5" force="20.0" severlimbsprobability="0.6"/>
|
||||||
<Fire size="500"/>
|
<Fire size="500"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
@@ -120,7 +124,8 @@
|
|||||||
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true"/>
|
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true"/>
|
||||||
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
|
||||||
|
|
||||||
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
|
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
|
||||||
|
<sound file="Content/Items/Reactor/explosion.ogg" range="3000"/>
|
||||||
<Explosion range="600.0" structuredamage="400" damage="300" stun="5" force="20.0" severlimbsprobability="0.4" decal="explosion" decalsize="0.5"/>
|
<Explosion range="600.0" structuredamage="400" damage="300" stun="5" force="20.0" severlimbsprobability="0.4" decal="explosion" decalsize="0.5"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<Turret barrelsprite="railgunbarrel.png" canbeselected = "true" linkable="true" origin="0.5, 0.85" barrelpos="128, 128"
|
<Turret barrelsprite="railgunbarrel.png" canbeselected = "true" linkable="true" origin="0.5, 0.85" barrelpos="128, 128"
|
||||||
rotationlimits="180,360"
|
rotationlimits="180,360"
|
||||||
powerconsumption="20000.0">
|
powerconsumption="20000.0">
|
||||||
<StatusEffect type="OnUse" target="This" sound="Content/Items/Weapons/railgun.ogg">
|
<StatusEffect type="OnUse" target="This">
|
||||||
|
<sound file="Content/Items/Weapons/railgun.ogg" range="5000"/>
|
||||||
<Explosion range="1000.0" structuredamage="0" force="0.01" camerashake="10.0"/>
|
<Explosion range="1000.0" structuredamage="0" force="0.01" camerashake="10.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Turret>
|
</Turret>
|
||||||
@@ -117,7 +118,8 @@
|
|||||||
<Projectile launchimpulse="80.0">
|
<Projectile launchimpulse="80.0">
|
||||||
<Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt" severlimbsprobability="1.0"/>
|
<Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt" severlimbsprobability="1.0"/>
|
||||||
|
|
||||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg">
|
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Weapons/bigexplosion.ogg"/>
|
||||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="0.8" decal="explosion" decalsize="1.0"/>
|
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="0.8" decal="explosion" decalsize="1.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
<Body width="11" height="24" density="30"/>
|
<Body width="11" height="24" density="30"/>
|
||||||
|
|
||||||
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10">
|
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10">
|
||||||
<StatusEffect type="OnUse" target="This" Condition="-100.0" delay="3.0" sound="Content/Items/Weapons/stungrenade.ogg">
|
<StatusEffect type="OnUse" target="This" Condition="-100.0" delay="3.0">
|
||||||
|
<sound file="Content/Items/Weapons/stungrenade.ogg"/>
|
||||||
<Explosion range="500" damage="5" stun="25" force="0.1"/>
|
<Explosion range="500" damage="5" stun="25" force="0.1"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Throwable>
|
</Throwable>
|
||||||
@@ -83,7 +84,8 @@
|
|||||||
<Body width="11" height="24" density="30"/>
|
<Body width="11" height="24" density="30"/>
|
||||||
|
|
||||||
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10">
|
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10">
|
||||||
<StatusEffect type="OnUse" target="This" Condition="-100.0" delay="3.0" sound="Content/Items/Weapons/stungrenade.ogg">
|
<StatusEffect type="OnUse" target="This" Condition="-100.0" delay="3.0">
|
||||||
|
<sound file="Content/Items/Weapons/stungrenade.ogg"/>
|
||||||
<Explosion range="500" damage="5" stun="1" force="0.1"/>
|
<Explosion range="500" damage="5" stun="1" force="0.1"/>
|
||||||
<Fire size="300.0"/>
|
<Fire size="300.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
@@ -110,11 +112,13 @@
|
|||||||
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
||||||
aimpos="50,0" handle1="-5,0" holdangle="10" reload="1.0">
|
aimpos="50,0" handle1="-5,0" holdangle="10" reload="1.0">
|
||||||
<Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/>
|
<Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/>
|
||||||
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="15.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
|
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="15.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Weapons/stunbaton.ogg"/>
|
||||||
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
|
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
|
||||||
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/>
|
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
<StatusEffect type="OnUse" target="Contained,Character" Condition="-15.0" stun="30.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
|
<StatusEffect type="OnUse" target="Contained,Character" Condition="-15.0" stun="30.0" disabledeltatime="true">
|
||||||
|
<sound file="Content/Items/Weapons/stunbaton.ogg"/>
|
||||||
<RequiredItem name="Fulgurium Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
|
<RequiredItem name="Fulgurium Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
|
||||||
<Explosion range="100.0" force="0.5" shockwave="false" flames="false" camerashake="5.0"/>
|
<Explosion range="100.0" force="0.5" shockwave="false" flames="false" camerashake="5.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|||||||
Binary file not shown.
@@ -26,6 +26,7 @@ namespace Barotrauma
|
|||||||
private List<ParticleEmitter> particleEmitters;
|
private List<ParticleEmitter> particleEmitters;
|
||||||
|
|
||||||
private Sound sound;
|
private Sound sound;
|
||||||
|
private bool loopSound;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public string[] propertyNames;
|
public string[] propertyNames;
|
||||||
@@ -132,11 +133,10 @@ namespace Barotrauma
|
|||||||
case "duration":
|
case "duration":
|
||||||
duration = ToolBox.GetAttributeFloat(attribute, 0.0f);
|
duration = ToolBox.GetAttributeFloat(attribute, 0.0f);
|
||||||
break;
|
break;
|
||||||
#if CLIENT
|
|
||||||
case "sound":
|
case "sound":
|
||||||
sound = Sound.Load(attribute.Value.ToString());
|
DebugConsole.ThrowError("Error in StatusEffect " + element.Parent.Name.ToString() +
|
||||||
|
" - sounds should be defined as child elements of the StatusEffect, not as attributes.");
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
propertyAttributes.Add(attribute);
|
propertyAttributes.Add(attribute);
|
||||||
break;
|
break;
|
||||||
@@ -181,6 +181,10 @@ namespace Barotrauma
|
|||||||
case "particleemitter":
|
case "particleemitter":
|
||||||
particleEmitters.Add(new ParticleEmitter(subElement));
|
particleEmitters.Add(new ParticleEmitter(subElement));
|
||||||
break;
|
break;
|
||||||
|
case "sound":
|
||||||
|
sound = Sound.Load(subElement);
|
||||||
|
loopSound = ToolBox.GetAttributeBool(subElement, "loop", false);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +231,24 @@ namespace Barotrauma
|
|||||||
protected void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets)
|
protected void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (sound != null) sound.Play(1.0f, 1000.0f, entity.WorldPosition);
|
if (sound != null)
|
||||||
|
{
|
||||||
|
if (loopSound)
|
||||||
|
{
|
||||||
|
if (!Sounds.SoundManager.IsPlaying(sound))
|
||||||
|
{
|
||||||
|
sound.Play(entity.WorldPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sound.UpdatePosition(entity.WorldPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sound.Play(entity.WorldPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (useItem)
|
if (useItem)
|
||||||
|
|||||||
@@ -53,8 +53,30 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
this.ParticleEmitter = new ParticleEmitter(prefab.ParticleEmitterPrefab);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,10 @@ namespace Barotrauma
|
|||||||
ParticleEmitterPrefab = new Particles.ParticleEmitterPrefab(subElement);
|
ParticleEmitterPrefab = new Particles.ParticleEmitterPrefab(subElement);
|
||||||
EmitterPosition = ToolBox.GetAttributeVector2(subElement, "position", Vector2.Zero);
|
EmitterPosition = ToolBox.GetAttributeVector2(subElement, "position", Vector2.Zero);
|
||||||
break;
|
break;
|
||||||
|
case "sound":
|
||||||
|
SoundElement = subElement;
|
||||||
|
SoundPosition = ToolBox.GetAttributeVector2(subElement, "position", Vector2.Zero);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user