Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs
T
Joonas Rikkonen 4a460ff150 - 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.
2017-08-20 19:05:25 +03:00

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);
}
}
}
}