Class Emitter
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.graphics.emitters.Emitter
- All Implemented Interfaces:
EntityRenderedListener,EntityRenderListener,IEntity,IRenderable,ITimeToLive,IUpdateable,Tweenable,EventListener
- Direct Known Subclasses:
EntityEmitter
A standard implementation for emitters that provide a particle effect.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class de.gurkenlabs.litiengine.entities.Entity
ANY_MESSAGE -
Constructor Summary
ConstructorsConstructorDescriptionEmitter()Emitter(double originX, double originY) Emitter(double x, double y, EmitterData emitterData) Emitter(EmitterData emitterData) Emitter(Point2D origin, EmitterData emitterData) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()voidaddParticle(Particle particle) Adds a particle to this Emitter's list of Particles.protected booleanCan take new particles.protected ParticleCreates the new particle.data()voidvoiddelete()longGets the alive time.Gets the particles.getRenderable(RenderType type) intGets the total time to live of this instance.booleanbooleanbooleanChecks if the emitter duration is reached.booleanisPaused()Checks if is paused.booleanvoidonFinished(Emitter.EmitterFinishedListener listener) protected booleanparticleCanBeRemoved(Particle particle) Particle can be removed.voidvoidrender(Graphics2D g) Renders the visual contents of this instance onto the provided graphics context.voidsetEmitterData(EmitterData emitterData) voidsetEmitterData(String emitterXmlPath) voidsetPaused(boolean paused) Sets the paused.voidsetStopped(boolean stopped) protected voidbooleanTime to live reached.voidvoidvoidupdate()This method is called by the game loop on all objects that are attached to the loop.protected voidMethods inherited from class de.gurkenlabs.litiengine.entities.Entity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getTweenValues, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setTweenValues, setVisible, setWidth, setX, setY, toString
-
Constructor Details
-
Emitter
public Emitter() -
Emitter
-
Emitter
-
Emitter
-
Emitter
-
Emitter
-
Emitter
public Emitter(double originX, double originY) -
Emitter
-
-
Method Details
-
activate
public void activate() -
addParticle
Adds a particle to this Emitter's list of Particles.- Parameters:
particle- the particle
-
deactivate
public void deactivate() -
delete
public void delete() -
getAliveTime
public long getAliveTime()Gets the alive time.- Specified by:
getAliveTimein interfaceITimeToLive- Returns:
- the alive time
-
data
-
getOrigin
-
updateOrigin
protected void updateOrigin() -
getRenderable
-
getParticles
Gets the particles.- Returns:
- the particles
-
isActivateOnInit
public boolean isActivateOnInit() -
isActivated
public boolean isActivated() -
isFinished
public boolean isFinished()Checks if the emitter duration is reached.- Returns:
- true, if the emitter is finished
-
isPaused
public boolean isPaused()Checks if is paused.- Returns:
- true, if is paused
-
setPaused
public void setPaused(boolean paused) Sets the paused.- Parameters:
paused- the new paused
-
isStopped
public boolean isStopped() -
setStopped
public void setStopped(boolean stopped) -
onFinished
-
removeFinishedListener
-
render
Description copied from interface:IRenderableRenders the visual contents of this instance onto the provided graphics context.If an
Entityimplements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
renderin interfaceIRenderable- Parameters:
g- The current graphics object onto which this instance will render its visual contents.- See Also:
-
setEmitterData
-
setEmitterData
-
timeToLiveReached
public boolean timeToLiveReached()Time to live reached.- Specified by:
timeToLiveReachedin interfaceITimeToLive- Returns:
- true, if successful
-
togglePaused
public void togglePaused() -
toggleStopped
public void toggleStopped() -
getTimeToLive
public int getTimeToLive()Description copied from interface:ITimeToLiveGets the total time to live of this instance.- Specified by:
getTimeToLivein interfaceITimeToLive- Returns:
- The total time to live.
-
update
public void update()Description copied from interface:IUpdateableThis method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using theClientConfiguration.- Specified by:
updatein interfaceIUpdateable- See Also:
-
canTakeNewParticles
protected boolean canTakeNewParticles()Can take new particles.- Returns:
- Whether-or-not the effect can hold any more particles.
-
createNewParticle
Creates the new particle.- Returns:
- the particle
-
particleCanBeRemoved
Particle can be removed.- Parameters:
particle- the particle- Returns:
- true, if successful
-
spawnParticle
protected void spawnParticle()
-