Changeset 5744 in orxonox.OLD for branches/world_entities/src/world_entities/weapons/bomb.cc
- Timestamp:
- Nov 23, 2005, 9:28:06 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/world_entities/src/world_entities/weapons/bomb.cc
r5603 r5744 16 16 #include "bomb.h" 17 17 #include "glincl.h" 18 #include "state.h" 19 #include "list.h" 18 20 #include "model.h" 21 #include "vector.h" 19 22 #include "fast_factory.h" 23 24 25 #include "particle_engine.h" 26 #include "particle_emitter.h" 27 #include "particle_system.h" 20 28 21 29 using namespace std; … … 32 40 if (root != NULL) 33 41 this->loadParams(root); 42 43 float modelSize = 1.0; 44 this->loadModel("models/projectiles/RadioActiveBomb.obj", 1.0); 45 46 this->energyMin = 1; 47 this->energyMax = 1; 48 this->remove(); 49 this->lifeSpan = 15; 50 51 this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5); 52 this->emitter->setParent(this); 53 this->emitter->setSpread(M_PI, M_PI); 34 54 } 35 55 … … 82 102 void Bomb::tick(float time) 83 103 { 104 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 105 Vector v = this->velocity * (time); 106 this->shiftCoor(v); 84 107 108 this->lifeCycle += time/this->lifeSpan; 109 if( this->lifeCycle >= 1.0) 110 { 111 PRINTF(5)("FINALIZE==========================\n"); 112 PRINTF(5)("current life cycle is: %f\n", this->lifeCycle); 113 PRINTF(5)("FINALIZE===========================\n"); 114 115 this->deactivate(); 116 } 85 117 } 86 118 … … 114 146 void Bomb::collidesWith (WorldEntity* entity, const Vector& location) 115 147 { 116 148 this->detonate(); 117 149 } 118 150 119 151 void Bomb::activate() 120 152 { 153 State::getWorldEntityList()->add(this); 121 154 122 155 } … … 124 157 void Bomb::deactivate() 125 158 { 159 State::getWorldEntityList()->remove(this); 160 Bomb::fastFactory->kill(this); 161 } 126 162 163 void Bomb::detonate() 164 { 165 tIterator<WorldEntity>* it = State::getWorldEntityList()->getIterator(); 166 WorldEntity* lm = it->firstElement(); 167 168 while(lm != NULL) 169 { 170 171 lm = it->nextElement(); 172 } 127 173 }
Note: See TracChangeset
for help on using the changeset viewer.