public abstract class Particle extends java.lang.Object implements ITimeToLive
Constructor and Description |
---|
Particle(float width,
float height,
java.awt.Color color,
int ttl)
Constructs a new particle.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Point2D |
getAbsoluteLocation(java.awt.geom.Point2D effectLocation) |
protected float |
getAbsoluteX(java.awt.geom.Point2D emitterOrigin) |
protected float |
getAbsoluteY(java.awt.geom.Point2D emitterOrigin) |
long |
getAliveTime()
Gets the time this instance is alive.
|
java.awt.geom.Rectangle2D |
getBoundingBox(java.awt.geom.Point2D origin) |
Collision |
getCollisionType() |
java.awt.Color |
getColor() |
int |
getColorAlpha() |
RenderType |
getCustomRenderType() |
float |
getDeltaHeight() |
float |
getDeltaWidth() |
float |
getDx() |
float |
getDy() |
float |
getGravityX() |
float |
getGravityY() |
float |
getHeight() |
protected float |
getOpacity() |
java.awt.geom.Point2D |
getRenderLocation(java.awt.geom.Point2D effectLocation)
Gets the location relative to the specified effect location.
|
int |
getTimeToLive()
Gets the total time to live of this instance.
|
float |
getWidth() |
float |
getX() |
float |
getY() |
boolean |
isContinuousCollisionEnabled() |
boolean |
isFading() |
boolean |
isFadingOnCollision() |
boolean |
isStoppingOnCollision() |
abstract void |
render(java.awt.Graphics2D g,
java.awt.geom.Point2D emitterOrigin) |
Particle |
setCollisionType(Collision collisionType) |
Particle |
setColor(java.awt.Color color) |
Particle |
setColorAlpha(int colorAlpha)
Sets the color alpha.
|
Particle |
setContinuousCollision(boolean ccd)
Enabling this check can be very performance hungry and should be used with caution and only for a small amount of particles.
|
Particle |
setCustomRenderType(RenderType renderType) |
Particle |
setDeltaHeight(float deltaHeight) |
Particle |
setDeltaIncX(float gravityX) |
Particle |
setDeltaIncY(float gravityY) |
Particle |
setDeltaWidth(float deltaWidth) |
Particle |
setDeltaX(float dx) |
Particle |
setDeltaY(float dy) |
Particle |
setFade(boolean fade) |
Particle |
setFadeOnCollision(boolean fadeOnCollision) |
Particle |
setHeight(float height) |
void |
setStopOnCollision(boolean stopOnCollision) |
Particle |
setWidth(float width) |
Particle |
setX(float x) |
Particle |
setY(float y) |
boolean |
timeToLiveReached()
Determines whether this instance has exceeded its time to live.
|
void |
update(java.awt.geom.Point2D emitterOrigin,
float updateRatio)
Updates the effect's position, change in xCurrent, change in yCurrent,
remaining lifetime, and color.
|
boolean |
usesCustomRenderType() |
public Particle(float width, float height, java.awt.Color color, int ttl)
width
- the widthheight
- the heightttl
- The remaining time to live of the particle.color
- The color of the effect.public long getAliveTime()
ITimeToLive
getAliveTime
in interface ITimeToLive
public java.awt.geom.Rectangle2D getBoundingBox(java.awt.geom.Point2D origin)
public Collision getCollisionType()
public java.awt.Color getColor()
public int getColorAlpha()
public float getDeltaHeight()
public float getDeltaWidth()
public float getDx()
public float getDy()
public float getGravityX()
public float getGravityY()
public float getHeight()
public java.awt.geom.Point2D getRenderLocation(java.awt.geom.Point2D effectLocation)
effectLocation
- the effect positionpublic RenderType getCustomRenderType()
public int getTimeToLive()
ITimeToLive
getTimeToLive
in interface ITimeToLive
public float getWidth()
public float getX()
public float getY()
public boolean isFading()
public boolean isFadingOnCollision()
public boolean isContinuousCollisionEnabled()
public boolean isStoppingOnCollision()
public abstract void render(java.awt.Graphics2D g, java.awt.geom.Point2D emitterOrigin)
public Particle setContinuousCollision(boolean ccd)
ccd
- If set to true, the collision will be checked continuously by a ray-cast approximation.public void setStopOnCollision(boolean stopOnCollision)
public Particle setColor(java.awt.Color color)
public Particle setColorAlpha(int colorAlpha)
colorAlpha
- the new color alphaParticle
instance to chain further setter calls.public Particle setDeltaHeight(float deltaHeight)
public Particle setDeltaIncX(float gravityX)
public Particle setDeltaIncY(float gravityY)
public Particle setDeltaWidth(float deltaWidth)
public Particle setDeltaX(float dx)
public Particle setDeltaY(float dy)
public Particle setFade(boolean fade)
public Particle setFadeOnCollision(boolean fadeOnCollision)
public Particle setHeight(float height)
public Particle setCustomRenderType(RenderType renderType)
public Particle setWidth(float width)
public Particle setX(float x)
public Particle setY(float y)
public boolean timeToLiveReached()
ITimeToLive
timeToLiveReached
in interface ITimeToLive
public void update(java.awt.geom.Point2D emitterOrigin, float updateRatio)
emitterOrigin
- The current Emitter
originupdateRatio
- The update ratio for this particle.public java.awt.geom.Point2D getAbsoluteLocation(java.awt.geom.Point2D effectLocation)
protected float getAbsoluteX(java.awt.geom.Point2D emitterOrigin)
protected float getAbsoluteY(java.awt.geom.Point2D emitterOrigin)
protected float getOpacity()
public boolean usesCustomRenderType()