4a460ff150
- 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.
47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using Barotrauma.Particles;
|
|
using Microsoft.Xna.Framework;
|
|
using System.Xml.Linq;
|
|
|
|
namespace Barotrauma
|
|
{
|
|
partial class Attack
|
|
{
|
|
private Sound sound;
|
|
|
|
private ParticleEmitter particleEmitterPrefab;
|
|
|
|
partial void InitProjSpecific(XElement element)
|
|
{
|
|
string soundPath = ToolBox.GetAttributeString(element, "sound", "");
|
|
if (!string.IsNullOrWhiteSpace(soundPath))
|
|
{
|
|
sound = Sound.Load(soundPath);
|
|
}
|
|
|
|
foreach (XElement subElement in element.Elements())
|
|
{
|
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
|
{
|
|
case "particleemitter":
|
|
particleEmitterPrefab = new ParticleEmitter(subElement);
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
partial void DamageParticles(float deltaTime, Vector2 worldPosition)
|
|
{
|
|
if (particleEmitterPrefab != null)
|
|
{
|
|
particleEmitterPrefab.Emit(deltaTime, worldPosition);
|
|
}
|
|
|
|
if (sound != null)
|
|
{
|
|
sound.Play(1.0f, 500.0f, worldPosition);
|
|
}
|
|
}
|
|
}
|
|
}
|