Particle additions:
- Support for subemitters (= particles can emit particles). - Option to set a different velocity change value for particles in water (can be used to simulate buouancy). - Fixed drag vector & timer not being reset when initializing a particle.
This commit is contained in:
@@ -101,6 +101,20 @@ namespace Barotrauma.Particles
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 velocityChangeWater;
|
||||
public Vector2 VelocityChangeWaterDisplay { get; private set; }
|
||||
|
||||
[Editable(ToolTip = "How much the velocity of the particle changes per second when in water."), Serialize("0.0,0.0", false)]
|
||||
public Vector2 VelocityChangeWater
|
||||
{
|
||||
get { return velocityChangeWater; }
|
||||
private set
|
||||
{
|
||||
velocityChangeWater = value;
|
||||
VelocityChangeWaterDisplay = ConvertUnits.ToDisplayUnits(value);
|
||||
}
|
||||
}
|
||||
|
||||
[Editable(0.0f, 10000.0f, ToolTip = "Drag applied to the particle when it's moving through water."), Serialize(0.0f, false)]
|
||||
public float CollisionRadius { get; private set; }
|
||||
|
||||
@@ -164,6 +178,8 @@ namespace Barotrauma.Particles
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
public readonly List<ParticleEmitterPrefab> SubEmitters = new List<ParticleEmitterPrefab>();
|
||||
|
||||
public Dictionary<string, SerializableProperty> SerializableProperties
|
||||
{
|
||||
get;
|
||||
@@ -191,9 +207,20 @@ namespace Barotrauma.Particles
|
||||
case "animatedsprite":
|
||||
Sprites.Add(new SpriteSheet(subElement));
|
||||
break;
|
||||
case "particleemitter":
|
||||
case "emitter":
|
||||
case "subemitter":
|
||||
SubEmitters.Add(new ParticleEmitterPrefab(subElement));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if velocity change in water is not given, it defaults to the normal velocity change
|
||||
if (element.Attribute("velocitychangewater") == null)
|
||||
{
|
||||
VelocityChangeWater = VelocityChange;
|
||||
}
|
||||
|
||||
if (element.Attribute("angularvelocity") != null)
|
||||
{
|
||||
AngularVelocityMin = element.GetAttributeFloat("angularvelocity", 0.0f);
|
||||
|
||||
Reference in New Issue
Block a user