Changeset 5443 in orxonox.OLD for trunk/src/world_entities/weapons/test_bullet.cc
- Timestamp:
- Oct 28, 2005, 9:44:57 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/test_bullet.cc
r5357 r5443 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 13 11 ### File Specific 14 12 main-programmer: Patrick Boenzli 15 co-programmer: 13 co-programmer: Benjamin Grauer 14 16 15 */ 17 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON … … 24 23 #include "fast_factory.h" 25 24 26 #include "obb_tree.h" 25 #include "state.h" 26 #include "list.h" 27 28 #include "particle_engine.h" 29 #include "particle_emitter.h" 30 #include "particle_system.h" 31 27 32 28 33 using namespace std; … … 44 49 this->remove(); 45 50 this->lifeSpan = 5; 51 52 this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 0.01); 53 this->emitter->setParent(this); 54 this->emitter->setEmissionRate(20); 55 56 this->emitter->setSpread(M_2_PI); 46 57 } 47 58 … … 52 63 TestBullet::~TestBullet () 53 64 { 65 delete this->emitter; 54 66 /* 55 67 do not delete the test projectModel, since it is pnode … … 59 71 } 60 72 73 ParticleSystem* TestBullet::explosionParticles = NULL; 74 75 76 void TestBullet::activate() 77 { 78 State::getWorldEntityList()->add(this); 79 if (unlikely(TestBullet::explosionParticles == NULL)) 80 { 81 TestBullet::explosionParticles = new ParticleSystem(10000, PARTICLE_SPRITE); 82 TestBullet::explosionParticles->setLifeSpan(.5); 83 TestBullet::explosionParticles->setRadius(0.0, .5); 84 TestBullet::explosionParticles->setRadius(0.5, 2.0); 85 TestBullet::explosionParticles->setRadius(0.0, 0.0); 86 TestBullet::explosionParticles->setColor(0.0, 1,0,0,.7); 87 TestBullet::explosionParticles->setColor(0.5, .8,.8,0,.5); 88 TestBullet::explosionParticles->setColor(1.0, .5,.5,.5,.0); 89 } 90 91 ParticleEngine::getInstance()->addConnection(this->emitter, TestBullet::explosionParticles); 92 } 93 94 95 void TestBullet::deactivate() 96 { 97 ParticleEngine::getInstance()->breakConnection(this->emitter, TestBullet::explosionParticles); 98 99 GarbageCollector::getInstance()->collect(this); 100 this->lifeCycle = 0.0; 101 } 102 103 61 104 void TestBullet::collidesWith(WorldEntity* entity, const Vector& location) 62 105 { 63 this->destroy(); 106 64 107 } 65 108 … … 81 124 PRINTF(5)("FINALIZE===========================\n"); 82 125 // this->finalize(); 83 GarbageCollector::getInstance()->collect(this); 84 this->lifeCycle = 0.0; //! @todo should not be here 126 this->deactivate(); 85 127 } 86 128 } … … 91 133 void TestBullet::destroy () 92 134 { 135 this->deactivate(); 93 136 137 138 GarbageCollector::getInstance()->collect(this); 94 139 95 140 }
Note: See TracChangeset
for help on using the changeset viewer.