- The emission rate of ParticleEmitters can be set as particles per second (instead of particles per frame).

- Particles that are outside the sub aren't visible inside hulls even if they overlap with the sub.
- ParticleManager takes the movement of the particles into account when determining which particles to cull. For example, a particle that will move upwards can be emitted even if it's below the camera view.
This commit is contained in:
Joonas Rikkonen
2017-08-20 19:05:25 +03:00
parent 3c0f099448
commit 4a460ff150
9 changed files with 94 additions and 38 deletions
@@ -23,7 +23,7 @@ namespace Barotrauma
private List<RelatedItem> requiredItems;
#if CLIENT
private List<ParticleEmitterPrefab> particleEmitters;
private List<ParticleEmitter> particleEmitters;
private Sound sound;
#endif
@@ -77,7 +77,7 @@ namespace Barotrauma
requiredItems = new List<RelatedItem>();
#if CLIENT
particleEmitters = new List<ParticleEmitterPrefab>();
particleEmitters = new List<ParticleEmitter>();
#endif
IEnumerable<XAttribute> attributes = element.Attributes();
@@ -179,7 +179,7 @@ namespace Barotrauma
break;
#if CLIENT
case "particleemitter":
particleEmitters.Add(new ParticleEmitterPrefab(subElement));
particleEmitters.Add(new ParticleEmitter(subElement));
break;
#endif
}
@@ -280,9 +280,9 @@ namespace Barotrauma
}
#if CLIENT
foreach (ParticleEmitterPrefab emitter in particleEmitters)
foreach (ParticleEmitter emitter in particleEmitters)
{
emitter.Emit(entity.WorldPosition, hull);
emitter.Emit(deltaTime, entity.WorldPosition, hull);
}
#endif
}
@@ -331,8 +331,8 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError("Couldn't apply value "+value.ToString()+" ("+type+") to property \""+property.Name+"\" ("+property.GetValue().GetType()+")! "
+"Make sure the type of the value set in the config files matches the type of the property.");
DebugConsole.ThrowError("Couldn't apply value " + value.ToString() + " (" + type + ") to property \"" + property.Name + "\" (" + property.GetValue().GetType() + ")! "
+ "Make sure the type of the value set in the config files matches the type of the property.");
}
}