Class ParticleSystem
- java.lang.Object
-
- be.yildizgames.module.graphic.particle.ParticleSystem
-
- All Implemented Interfaces:
be.yildizgames.common.gameobject.Deletable,be.yildizgames.common.gameobject.Movable
public abstract class ParticleSystem extends Object implements be.yildizgames.common.gameobject.Movable
Particle system, contains the material use by the particles, their size, the quota and a list of emitters.- Author:
- Grégory Van den Borre
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParticleSystem.OrientationParticle orientation possibilities.static classParticleSystem.OriginParticle origin.
-
Constructor Summary
Constructors Modifier Constructor Description protectedParticleSystem()Protected constructor, only called from children.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ParticleColorAffectoraddColorAffector()Create a color affector.ParticleEmitteraddEmitter(ParticleEmitter.EmitterType type)Create a new particle emitter and add it to the list.ParticleForceAffectoraddForceAffector()Create a force affector.ParticleScaleAffectoraddScaleAffector()Create a scale affector.protected abstract ParticleColorAffectorcreateColorAffector()Create a color affector in implementation.protected abstract ParticleEmittercreateEmitter(ParticleEmitter.EmitterType type)Create a new emitter in implementation.protected abstract ParticleForceAffectorcreateForceAffector()Create a force affector in implementation.protected abstract ParticleScaleAffectorcreateScaleAffector()Create a scale affector in implementation.ParticleEmittergetEmitter(int index)Get the emitter for the given index.MaterialgetMaterial()ParticleSystem.OrientationgetOrientation()ParticleSystem.OrigingetOrigin()intgetQuota()abstract voidhide()abstract voidkeepInLocalSpace(boolean keep)abstract voidrotate(float yaw, float pitch)ParticleSystemsetMaterial(Material material)Set a material for the particles.protected abstract voidsetMaterialImpl(Material newMaterial)Set the material in implementation.ParticleSystemsetOrientation(ParticleSystem.Orientation newOrientation)Set the particle orientation type.protected abstract voidsetOrientationImpl(ParticleSystem.Orientation newOrientation)Set the particle orientation type in implementation.ParticleSystemsetOrigin(ParticleSystem.Origin origin)Set the particle origin.protected abstract voidsetOriginImpl(ParticleSystem.Origin origin)Implementation specific to set the particle origin.ParticleSystemsetQuota(int newQuota)Set the maximum number of particle at one time for this system.protected abstract voidsetQuotaImpl(int newQuota)Set the quota value in implementation.ParticleSystemsetSize(float newWidth, float newHeight)Set the size for the particles.ParticleSystemsetSize(be.yildizgames.common.geometry.Size2 size)protected abstract voidsetSizeImpl(float width, float height)set the particle size in implementation.abstract voidshow()voidstart()Starts all emitters.voidstop()Stops all emitters.
-
-
-
Method Detail
-
addEmitter
public final ParticleEmitter addEmitter(ParticleEmitter.EmitterType type)
Create a new particle emitter and add it to the list.- Parameters:
type- Type of the emitter.- Returns:
- the newly built particle emitter.
-
addColorAffector
public final ParticleColorAffector addColorAffector()
Create a color affector.- Returns:
- The newly created color affector.
-
addForceAffector
public final ParticleForceAffector addForceAffector()
Create a force affector.- Returns:
- The newly created force affector.
-
addScaleAffector
public final ParticleScaleAffector addScaleAffector()
Create a scale affector.- Returns:
- The newly created scale affector.
-
stop
public final void stop()
Stops all emitters.
-
start
public final void start()
Starts all emitters.
-
getMaterial
public final Material getMaterial()
-
getQuota
public final int getQuota()
-
getOrientation
public final ParticleSystem.Orientation getOrientation()
-
getOrigin
public final ParticleSystem.Origin getOrigin()
-
createEmitter
protected abstract ParticleEmitter createEmitter(ParticleEmitter.EmitterType type)
Create a new emitter in implementation.- Parameters:
type- Emitter type.- Returns:
- The built emitter.
-
createColorAffector
protected abstract ParticleColorAffector createColorAffector()
Create a color affector in implementation.- Returns:
- The newly created color affector.
-
createForceAffector
protected abstract ParticleForceAffector createForceAffector()
Create a force affector in implementation.- Returns:
- The newly created force affector.
-
createScaleAffector
protected abstract ParticleScaleAffector createScaleAffector()
Create a scale affector in implementation.- Returns:
- The newly created scale affector.
-
keepInLocalSpace
public abstract void keepInLocalSpace(boolean keep)
- Parameters:
keep-trueTo keep particles in local space.
-
setOrigin
public final ParticleSystem setOrigin(ParticleSystem.Origin origin)
Set the particle origin.- Parameters:
origin- new particle origin.- Returns:
- This.
-
setMaterial
public final ParticleSystem setMaterial(Material material)
Set a material for the particles.- Parameters:
material- New material.- Returns:
- This.
-
setQuota
public final ParticleSystem setQuota(int newQuota)
Set the maximum number of particle at one time for this system.- Parameters:
newQuota- New quota value.- Returns:
- This.
-
setSize
public final ParticleSystem setSize(float newWidth, float newHeight)
Set the size for the particles.- Parameters:
newWidth- New width for the particles.newHeight- New height for the particles.- Returns:
- This.
-
setSize
public final ParticleSystem setSize(be.yildizgames.common.geometry.Size2 size)
-
setOrientation
public final ParticleSystem setOrientation(ParticleSystem.Orientation newOrientation)
Set the particle orientation type.- Parameters:
newOrientation- New orientation.- Returns:
- This.
-
getEmitter
public final ParticleEmitter getEmitter(int index)
Get the emitter for the given index.- Parameters:
index- Index of the emitter to retrieve.- Returns:
- The Emitter matching the given index.
-
setOrientationImpl
protected abstract void setOrientationImpl(ParticleSystem.Orientation newOrientation)
Set the particle orientation type in implementation.- Parameters:
newOrientation- New orientation value.
-
setSizeImpl
protected abstract void setSizeImpl(float width, float height)set the particle size in implementation.- Parameters:
width- New width value.height- New height value.
-
setMaterialImpl
protected abstract void setMaterialImpl(Material newMaterial)
Set the material in implementation.- Parameters:
newMaterial- New material to use.
-
setQuotaImpl
protected abstract void setQuotaImpl(int newQuota)
Set the quota value in implementation.- Parameters:
newQuota- New quota value.
-
setOriginImpl
protected abstract void setOriginImpl(ParticleSystem.Origin origin)
Implementation specific to set the particle origin.- Parameters:
origin- Particle origin.
-
hide
public abstract void hide()
-
show
public abstract void show()
-
rotate
public abstract void rotate(float yaw, float pitch)
-
-