26 GenerateParticles<T>(100);
27 SetParticleLifespan(1);
37 RotatingParticle *pT = (RotatingParticle *)pParticle;
38 assert(pT &&
"Type of template T is not compatible.");
40 ParticleTemplate::InitializeParticle(pT);
42 pT->SetScale(Vector2::One * 0.1f);
45 pT->SetRotation(Math::GetRandomFloat() * Math::PI * 2);
46 pT->SetRotationVelocity(Math::GetRandomFloat() * 0.2f - 0.1f);
48 pT->SetPosition(pT->GetPosition() + Vector2::GetRandom(
true) * 2);
57 RotatingParticle *pT = (RotatingParticle *)pParticle;
58 assert(pT &&
"Type of template T is not compatible.");
60 float value = pT->GetInterpolationValue();
61 float scale = (1 - value) * 0.25f + 0.1f;
62 pT->SetScale(Vector2::One * scale);
63 pT->SetAlpha(value * 0.125f);
65 float rotation = pT->GetRotation() + pT->GetRotationVelocity();
67 pT->SetRotation(rotation);
74 return GetInactiveParticleOfType<T>();
Sample is a sample game to use as a template for using Katana Engine and Shooter Library.
Definition: Background.cpp:14
virtual Particle * GetInactiveParticle()
Gets an inactive particle to reuse.
Definition: SmokeTemplate.h:72
virtual void InitializeParticle(Particle *pParticle)
Initaializes the particle. This runs when a particle is emitted.
Definition: SmokeTemplate.h:35
Template for smoke particles.
Definition: SmokeTemplate.h:19
virtual void UpdateParticle(Particle *pParticle, const GameTime *pGameTime)
Updates the particle.
Definition: SmokeTemplate.h:55