|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.TimedEmission
public class TimedEmission
TimedEmission Class
The TimedEmission class implements the PSEmission interface allowing the automated emission of random particles derived from the object variables from any emitters to which it is assigned.
Unlike the TemplateEmission class, the particle emission interval and particle amount are user-specified and invariant.
TemplateEmission
Field Summary |
---|
Fields inherited from interface pslib.PSConstants |
---|
CAM2D_LOOK, CAM2D_RIGHT, CAM2D_UP, CORNER, INVERSE, INVERSE_TRIANGULAR, LEADING, LINEAR, MIDPOINT, NONE, STATIC, TRAILING, TRIANGULAR |
Constructor Summary | |
---|---|
TimedEmission(DynamicParticle t,
int i,
int p)
Create a new object instance with the specified variables |
|
TimedEmission(WeightedList<DynamicParticle> t,
int i,
int p)
Create a new object instance with the specified variables |
Method Summary | |
---|---|
void |
addListener(ParticleListener p)
Attach a particle listener |
void |
clearListeners()
Clear all attached particle listeners |
boolean |
removeListener(ParticleListener p)
Remove a particle listener |
void |
setActive(boolean a)
Set the active state of the behaviour |
void |
setAlpha(float a,
int v)
Set the emitted particle alpha value and variance |
void |
setDecay(int d,
int v)
Set the emitted particle decay value and variance |
void |
setEmissionInterval(int i)
Set the particle emission interval |
void |
setEmittedParticles(int p)
Set the amount of particles emitted on each particle emission event |
void |
setPalette(WeightedList<PSColour> p)
Set the particle colour palette |
void |
setSize(float s,
int v)
Set the emitted particle size value and variance |
void |
setTemplate(WeightedList<DynamicParticle> t)
Set the particle template |
void |
update(DynamicParticle p)
Update the specified particle (unused) |
void |
update(GenericEmitter e)
Update the specified emitter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimedEmission(DynamicParticle t, int i, int p)
Default decay, size and alpha values are taken from the specified particle with 0% variance.
t
- particle templatei
- emission intervalp
- particle amountpublic TimedEmission(WeightedList<DynamicParticle> t, int i, int p)
Default decay, size and alpha values are taken from a particle selected at random from the specified list with 0% variance.
t
- particle template listi
- emission intervalp
- particle amountMethod Detail |
---|
public final void setTemplate(WeightedList<DynamicParticle> t)
The particle template specifies the list of particles from which emitted particles may be derived. If no palette is specified emitted particles will inherit their colour from the template.
t
- particle templatepublic final void setPalette(WeightedList<PSColour> p)
The particle colour palette specifies the list of colours from which emitted particles may select. If no palette is specified emitted particles will inherit their colour from the particle template.
p
- colour palettepublic final void setActive(boolean a)
A value of true will result in particle emission on the update routine of any emitters to which this behaviour is attached.
Default: true
setActive
in interface PSEmission
a
- public final void setEmissionInterval(int i)
The particle emission interval specifies how many calls are required
to the GenericEmitter.update()
between emission events.
Typically emitter updates will occur on a per-frame basis, so in many cases
this value may be viewed as a frame interval.
i
- intervalpublic final void setEmittedParticles(int p)
p
- particlespublic final void setDecay(int d, int v)
d
- decay time (ms)v
- variance (+/- %)public final void setSize(float s, int v)
s
- sizev
- variance (+/- %)public final void setAlpha(float a, int v)
a
- alphav
- variance (+/- %)public void update(GenericEmitter e)
The update routine attaches random particles derived from the object variables to the specified emitter. References to created particles are sent to any attached listeners.
update
in interface PSEmission
e
- emitterpublic void update(DynamicParticle p)
update
in interface PSBehaviour
p
- particlepublic final void addListener(ParticleListener p)
Attached listeners will receive a reference to created particles upon emission. If this object is assigned as behaviour to multiple emitters, attached listeners will receive particles from each.
p
- particle listenerpublic final boolean removeListener(ParticleListener p)
p
- particle listener
public final void clearListeners()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |