public abstract class Emitter extends Entity implements IUpdateable, ITimeToLive, IRenderable
Modifier and Type | Class and Description |
---|---|
static interface |
Emitter.EmitterFinishedListener |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAXPARTICLES |
static java.awt.Color |
DEFAULT_PARTICLE_COLOR |
static int |
DEFAULT_SPAWNAMOUNT |
static int |
DEFAULT_UPDATERATE |
ANY_MESSAGE
Constructor and Description |
---|
Emitter() |
Emitter(double originX,
double originY) |
Emitter(java.awt.geom.Point2D origin) |
Modifier and Type | Method and Description |
---|---|
void |
activate() |
void |
addParticle(Particle particle)
Sets all of the data of the specified particle to the new data provided.
|
protected void |
addParticleColor(java.awt.Color... colors) |
protected boolean |
canTakeNewParticles()
Can take new particles.
|
protected abstract Particle |
createNewParticle()
Creates the new particle.
|
void |
deactivate()
Deactivate.
|
void |
delete() |
long |
getAliveTime()
Gets the alive time.
|
java.util.List<java.awt.Color> |
getColors() |
int |
getMaxParticles()
Gets the max particles.
|
java.awt.geom.Point2D |
getOrigin() |
Align |
getOriginAlign() |
Valign |
getOriginValign() |
int |
getParticleMaxTTL() |
int |
getParticleMinTTL() |
void |
getParticleMinTTL(int minTTL) |
java.util.List<Particle> |
getParticles()
Gets the particles.
|
int |
getParticleUpdateRate() |
protected java.awt.Color |
getRandomParticleColor() |
protected int |
getRandomParticleTTL() |
protected int |
getRandomParticleX() |
protected int |
getRandomParticleY() |
IRenderable |
getRenderable(RenderType type) |
Quality |
getRequiredQuality() |
int |
getSpawnAmount() |
int |
getSpawnRate()
Gets the spawn rate in milliseconds.
|
int |
getTimeToLive()
Gets the time to live.
|
boolean |
isActivated() |
boolean |
isActivateOnInit() |
boolean |
isFinished()
Checks if is finished.
|
boolean |
isPaused()
Checks if is paused.
|
boolean |
isStopped() |
void |
onFinished(Emitter.EmitterFinishedListener listener) |
protected boolean |
particleCanBeRemoved(Particle particle)
Particle can be removed.
|
void |
removeFinishedListener(Emitter.EmitterFinishedListener listener) |
void |
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.
|
void |
setColors(java.awt.Color... colors) |
void |
setMaxParticles(int maxPart) |
void |
setOriginAlign(Align align) |
void |
setOriginValign(Valign valign) |
void |
setParticleMaxTTL(int maxTTL) |
void |
setParticleMinTTL(int minTTL) |
void |
setParticleUpdateRate(int delay) |
void |
setPaused(boolean paused)
Sets the paused.
|
void |
setRequiredQuality(Quality requiredQuality) |
void |
setSpawnAmount(int spawnAmount) |
void |
setSpawnRate(int spawnRate) |
void |
setStopped(boolean stopped) |
void |
setTimeToLive(int ttl) |
protected void |
spawnParticle()
Spawn particle.
|
boolean |
timeToLiveReached()
Time to live reached.
|
void |
togglePaused() |
void |
toggleStopped() |
void |
update()
This method is called by the game loop on all objects that are attached to the loop.
|
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeEntityRenderedListener, removeEntityRenderListener, removeListener, removeMessageListener, removeTag, removeTransformListener, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setVisible, setWidth, setX, setY, toString
public static final java.awt.Color DEFAULT_PARTICLE_COLOR
public static final int DEFAULT_UPDATERATE
public static final int DEFAULT_SPAWNAMOUNT
public static final int DEFAULT_MAXPARTICLES
public Emitter()
public Emitter(double originX, double originY)
public Emitter(java.awt.geom.Point2D origin)
public void activate()
public void addParticle(Particle particle)
particle
- the particlepublic void deactivate()
public void delete()
public long getAliveTime()
getAliveTime
in interface ITimeToLive
public java.util.List<java.awt.Color> getColors()
public java.awt.geom.Point2D getOrigin()
public Align getOriginAlign()
public Valign getOriginValign()
public IRenderable getRenderable(RenderType type)
public int getMaxParticles()
public int getParticleMaxTTL()
public int getParticleMinTTL()
public void getParticleMinTTL(int minTTL)
public java.util.List<Particle> getParticles()
public int getParticleUpdateRate()
public Quality getRequiredQuality()
public int getSpawnAmount()
public int getSpawnRate()
public int getTimeToLive()
getTimeToLive
in interface ITimeToLive
public boolean isActivateOnInit()
public boolean isActivated()
public boolean isFinished()
public boolean isPaused()
public boolean isStopped()
public void onFinished(Emitter.EmitterFinishedListener listener)
public void removeFinishedListener(Emitter.EmitterFinishedListener listener)
public void render(java.awt.Graphics2D g)
IRenderable
If an Entity
implements 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.
render
in interface IRenderable
g
- The current graphics object onto which this instance will render its visual contents.RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
public void setColors(java.awt.Color... colors)
public void setMaxParticles(int maxPart)
public void setOriginAlign(Align align)
public void setOriginValign(Valign valign)
public void setParticleMaxTTL(int maxTTL)
public void setParticleMinTTL(int minTTL)
public void setParticleUpdateRate(int delay)
public void setPaused(boolean paused)
paused
- the new pausedpublic void setStopped(boolean stopped)
public void setRequiredQuality(Quality requiredQuality)
public void setSpawnAmount(int spawnAmount)
public void setSpawnRate(int spawnRate)
public void setTimeToLive(int ttl)
public boolean timeToLiveReached()
timeToLiveReached
in interface ITimeToLive
public void togglePaused()
public void toggleStopped()
public void update()
IUpdateable
ClientConfiguration
.update
in interface IUpdateable
ClientConfiguration.setMaxFps(int)
protected void addParticleColor(java.awt.Color... colors)
protected boolean canTakeNewParticles()
protected abstract Particle createNewParticle()
protected java.awt.Color getRandomParticleColor()
protected int getRandomParticleTTL()
protected int getRandomParticleX()
protected int getRandomParticleY()
protected boolean particleCanBeRemoved(Particle particle)
particle
- the particleprotected void spawnParticle()