Changeset 7103 in orxonox.OLD for trunk/src/world_entities/effects
- Timestamp:
- Feb 7, 2006, 9:45:52 PM (19 years ago)
- Location:
- trunk/src/world_entities/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/effects/explosion.cc
r7047 r7103 23 23 #include "class_list.h" 24 24 25 #include " dot_emitter.h"25 #include "box_emitter.h" 26 26 #include "sprite_particles.h" 27 27 … … 30 30 31 31 CREATE_FAST_FACTORY_STATIC(Explosion, CL_EXPLOSION); 32 32 33 33 34 /** … … 38 39 this->setClassID(CL_EXPLOSION, "Explosion"); 39 40 40 this->emitter = new DotEmitter(100, 5, M_2_PI);41 this->emitter = new BoxEmitter(Vector(10,10,10), 300, 50, M_2_PI); 41 42 this->emitter->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 42 43 this->emitter->setParent(this); … … 44 45 45 46 this->lifeCycle = 0.0f; 46 this->lifeTime = 4.0f;47 this->lifeTime = 0.5f; 47 48 48 49 } … … 63 64 SpriteParticles* Explosion::explosionParticles = NULL; 64 65 66 void Explosion::explode(PNode* position, const Vector& size) 67 { 68 Explosion* explosion = dynamic_cast<Explosion*>(Explosion::fastFactory->resurrect()); 69 explosion->setParent(position); 70 explosion->emitter->setSize(size); 71 explosion->activate(); 72 } 73 74 65 75 void Explosion::activate() 66 76 { 67 77 if (unlikely(Explosion::explosionParticles == NULL)) 68 78 { 69 Explosion::explosionParticles = new SpriteParticles( 200);79 Explosion::explosionParticles = new SpriteParticles(5000); 70 80 Explosion::explosionParticles->setName("ExplosionExplosionParticles"); 71 81 Explosion::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png"); … … 74 84 Explosion::explosionParticles->setRadius(.5, 15.0); 75 85 Explosion::explosionParticles->setRadius(1.0, 10.0); 76 Explosion::explosionParticles->setColor(0.0, 0,1,0,1);86 Explosion::explosionParticles->setColor(0.0, 1,0,0,1); 77 87 Explosion::explosionParticles->setColor(0.5, .8,.8,0,.8); 78 88 Explosion::explosionParticles->setColor(0.8, .8,.8,.3,.8); … … 86 96 this->emitter->setEmissionVelocity(0.0); 87 97 this->toList(OM_DEAD_TICK); 98 this->lifeCycle = 0.0; 88 99 } 89 100 … … 92 103 { 93 104 this->emitter->setSystem(NULL); 94 this->lifeCycle = 0.0;95 105 this->toList(OM_DEAD); 96 106 this->emitter->setParent(PNode::getNullParent()); 97 107 Explosion::fastFactory->kill(this); 98 108 } -
trunk/src/world_entities/effects/explosion.h
r7047 r7103 10 10 11 11 class SpriteParticles; 12 class ParticleEmitter;12 class BoxEmitter; 13 13 class FastFactory; 14 14 … … 16 16 { 17 17 public: 18 static void explode (PNode* position, const Vector& size); 19 18 20 Explosion (); 19 21 virtual ~Explosion (); … … 30 32 float lifeCycle; 31 33 32 static SpriteParticles* 33 ParticleEmitter* emitter;34 static SpriteParticles* explosionParticles; 35 BoxEmitter* emitter; 34 36 }; 35 37
Note: See TracChangeset
for help on using the changeset viewer.