Allows interesting visual effects to be created and attached to entities.
This is a global object that can always be accessed.
When it’s time to put some fire in your brazier, or smoke in your chimney, it’s time for particle systems.
The EffectManager is based around Wong Chin Foo’s LinearParticle system. Although the interface has been somewhat streamlined to match the rest of Novashell, you might want to check out his webpage at (http://galaxist.net/file/linear_p/latest_doc) to glean some info on its inner-workings.
The effect system is modular to allow more flexibility. You plug and play different pieces together to get the effect you want.
|Particle||A global template Particle that is shared between effects.|
|MotionController||Every Particle has a MotionController that can be accessed to setup special movement.|
|EffectBase||All effect emitters are derived from EffectBase and contain its functions too.|
|EffectExplosion||A type of particle emitter good for explosions. Create an EffectExplosion, attach one or more particles, then assign it to an entity with <Entity:AddEffect>.|
Particle CreateParticle(string name, string imageFileName, number lifeMS)
Allows you to create a particle template that can be referenced by name. If you change any parameters later on this particle, all particle systems using it will be modified.
local particle = GetEffectManager:GetParticleByName("smoke_brazier");
if (not particle) then
//doesn't exist? We'll need to create it then.
particle = GetEffectManager:CreateParticle("smoke_brazier", "effects/media/explosion.png", 500);
//now we can use "particle" anywhere needed.
|name||A name that can be used to access this particle in the future. It will give an error if the name already exists.|
|imageFileName||An image to use for the particles visual. Generally a 32 bit .png is used.|
|lifeMS||How long this type of particle ‘lives’ before disappearing.|
A handle to a global Particle object created that can be used to make additional changes.
Particle GetParticleByName(string name)
The shared Particle previously created with the same name, or nil if it doesn’t exist yet.
EffectExplosion CreateEffectExplosion(number periodMS, number minParticles, number maxParticles, number initialSpeed)
Creates a new EffectExplosion object. You must use <Entity::AddEffect> to add it to an entity. When its containing entity is destroyed it is destroyed also. Trying to attach the same explosion to two or more entities will explode your computer, don’t do it.
|periodMS||interval between two emissions in milliseconds|
|minParticles||The minimum number of particles to be emitted during a period|
|maxParticles||The maximum number of particles to be emitted during a period|
|intialSpeed||The initial velocity that particles have when created|
The new EffectExplosion object, ready to be attached to an entity with <Entity::AddEffect>.