|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.TemplateEmission
public class TemplateEmission
TemplateEmission Class
The TemplateEmission 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 VariantEmission class, individual particle parameters may have independent variance and may be subject to modification after creation.
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
VariantEmission
Constructor Summary | |
---|---|
TemplateEmission(DynamicParticle t,
int ep,
int mi,
int ma)
Create a new object instance with the specified variables |
|
TemplateEmission(WeightedList<DynamicParticle> t,
int ep,
int mi,
int ma)
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 |
setEmissionProbability(int p)
Set the emission probability |
void |
setEmittedParticles(int p)
Set the amount of particles emitted on each emission event |
void |
setEmittedParticles(int min,
int max)
Set the amount of particles emitted on each 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 TemplateEmission(DynamicParticle t, int ep, int mi, int ma)
Default decay, size and alpha values are taken from the specified particle with 0% variance.
t
- particle templateep
- emission probabilitymi
- minimum emitted particlesma
- maximum emitted particlespublic TemplateEmission(WeightedList<DynamicParticle> t, int ep, int mi, int ma)
Default decay, size and alpha values are taken from a particle selected at random from the specified list with 0% variance.
t
- particle template listep
- emission probabilitymi
- minimum emitted particlesma
- maximum emitted particlesMethod 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 setEmissionProbability(int p)
The emission probability specifies the probability of particle creation in the format 1:probability.
p
- emission probabilitypublic final void setEmittedParticles(int p)
p
- particlespublic final void setEmittedParticles(int min, int max)
The actual amount of emitted particles will be derived at random from the specified range.
min
- minimum particlesmax
- maximum particlespublic final void setDecay(int d, int v)
d
- decay (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 |