Module technology.sola.engine
Class ParticleEmitterComponent
java.lang.Object
technology.sola.engine.physics.component.ParticleEmitterComponent
- All Implemented Interfaces:
technology.sola.ecs.Component
@NullMarked
public class ParticleEmitterComponent
extends Object
implements technology.sola.ecs.Component
ParticleEmitterComponent is a
Component
that contains data for emitting ParticleEmitterComponent.Particle
s as well as data for
its emitted particles.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Particle contains properties that represent a particle that has been emitted from aParticleEmitterComponent
. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a ParticleEmitterComponent instance with default settings.ParticleEmitterComponent
(float particleEmissionDelay) Creates a ParticleEmitterComponent instance with default settings and a custom particle emission delay. -
Method Summary
Modifier and TypeMethodDescriptionvoid
emitIfAble
(float delta) Emits new particles if enough time has elapsed based on the set properties for emission.setParticleColor
(Color particleColor) Updates the baseColor
of each newParticleEmitterComponent.Particle
.setParticleEmissionDelay
(float particleEmissionDelay) Updates the delay between each particle emission.setParticleLife
(float life) Updates the lifespan for newly emittedParticleEmitterComponent.Particle
s to be a fixed value.setParticleLifeBounds
(float particleMinLife, float particleMaxLife) Updates the minimum and maximum lifespans for newly emittedParticleEmitterComponent.Particle
s.setParticleSize
(float size) Updates the size for newly emittedParticleEmitterComponent.Particle
s to be a fixed value.setParticleSizeBounds
(float particleMinSize, float particleMaxSize) Updates the minimum and maximum size values for newly emittedParticleEmitterComponent.Particle
s.setParticlesPerEmit
(int particlesPerEmit) Updates the number of particles to emit per emission.setParticleVelocity
(Vector2D velocity) Updates the velocity for newly emittedParticleEmitterComponent.Particle
s to be a fixed value.setParticleVelocityBounds
(Vector2D particleMinVelocity, Vector2D particleMaxVelocity) Updates the minimum and maximum velocities for newly emittedParticleEmitterComponent.Particle
s.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface technology.sola.ecs.Component
afterDeserialize
-
Constructor Details
-
ParticleEmitterComponent
public ParticleEmitterComponent()Creates a ParticleEmitterComponent instance with default settings. -
ParticleEmitterComponent
public ParticleEmitterComponent(float particleEmissionDelay) Creates a ParticleEmitterComponent instance with default settings and a custom particle emission delay.- Parameters:
particleEmissionDelay
- the desired particle emission delay
-
-
Method Details
-
emitIfAble
public void emitIfAble(float delta) Emits new particles if enough time has elapsed based on the set properties for emission.- Parameters:
delta
- the elapsed delta time
-
emittedParticleIterator
- Returns:
- the
Iterator
forParticleEmitterComponent.Particle
s
-
setParticleEmissionDelay
Updates the delay between each particle emission.- Parameters:
particleEmissionDelay
- the new particle emission delay- Returns:
- this
-
setParticlesPerEmit
Updates the number of particles to emit per emission.- Parameters:
particlesPerEmit
- the new number of particles to emit- Returns:
- this
-
setParticleColor
Updates the baseColor
of each newParticleEmitterComponent.Particle
.- Parameters:
particleColor
- the new color for newly emitted particles- Returns:
- this
-
setParticleLifeBounds
Updates the minimum and maximum lifespans for newly emittedParticleEmitterComponent.Particle
s.- Parameters:
particleMinLife
- the minimum lifespan for a new particleparticleMaxLife
- the maximum lifespan for a new particle- Returns:
- this
-
setParticleLife
Updates the lifespan for newly emittedParticleEmitterComponent.Particle
s to be a fixed value.- Parameters:
life
- the lifespan for new particles- Returns:
- this
-
setParticleVelocityBounds
public ParticleEmitterComponent setParticleVelocityBounds(Vector2D particleMinVelocity, Vector2D particleMaxVelocity) Updates the minimum and maximum velocities for newly emittedParticleEmitterComponent.Particle
s.- Parameters:
particleMinVelocity
- the minimum velocity for new particlesparticleMaxVelocity
- the maximum velocity for new particles- Returns:
- this
-
setParticleVelocity
Updates the velocity for newly emittedParticleEmitterComponent.Particle
s to be a fixed value.- Parameters:
velocity
- the velocity for new particles- Returns:
- this
-
setParticleSizeBounds
Updates the minimum and maximum size values for newly emittedParticleEmitterComponent.Particle
s.- Parameters:
particleMinSize
- the minimum size for new particlesparticleMaxSize
- the maximum size for new particles- Returns:
- this
-
setParticleSize
Updates the size for newly emittedParticleEmitterComponent.Particle
s to be a fixed value.- Parameters:
size
- the size for new particles- Returns:
- this
-