//--------------------------------------------------------------------------- public bool Update(float deltaTime, ParticleDesc desc) { LifeTime += deltaTime; RelativeLifeTime = (LifeTime / MaxLifeTime); if (LifeTime >= MaxLifeTime) { return(true); } Velocity = (Velocity - Vector3.UnitZ * desc.Gravity(RelativeLifeTime)) * (1.0f - desc.Inertia(RelativeLifeTime)); if (Drift.Length() > 0) { Matrix rotMatrix = Matrix.CreateFromAxisAngle(Vector3.Normalize(Drift), MathHelper.ToRadians(Drift.Length())); Velocity = Vector3.Transform(Velocity, rotMatrix); } Location += Velocity; if (Location.Z < 0) { Location = new Vector3(Location.X, Location.Y, 0); Velocity = new Vector3(Velocity.X, Velocity.Y, -Velocity.Z * desc.Restitution(RelativeLifeTime)); } return(false); }
//--------------------------------------------------------------------------- public ParticleEmitter(EEmitterType type, ParticleDesc desc) { Type = type; m_Particles = new List <Particle>(); m_Rand = new Random(); Description = (desc != null ? desc : ParticleDesc.Default); }
//--------------------------------------------------------------------------- public CircleParticleEmitter(float innerRadius, float outerRadius, ParticleDesc desc = null) : base(EEmitterType.Circle, desc) { InnerRadius = innerRadius; OuterRadius = outerRadius; }
public PointParticleEmitter(Vector3 center, ParticleDesc desc = null) : base(EEmitterType.Point, desc) { Center = center; }