- Timestamp:
- Nov 23, 2005, 9:28:06 PM (19 years ago)
- Location:
- branches/world_entities/src/world_entities/weapons
- Files:
-
- 3 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 } -
branches/world_entities/src/world_entities/weapons/bomb.h
r5603 r5744 9 9 #include "projectile.h" 10 10 class FastFactory; 11 class ParticleSystem; 12 class ParticleEmitter; 11 13 12 14 //! A Class to ... … … 29 31 virtual void collidesWith (WorldEntity* entity, const Vector& location); 30 32 virtual void activate(); 33 virtual void detonate(); 31 34 virtual void deactivate(); 32 35 33 36 private: 34 37 static FastFactory* fastFactory; 38 static ParticleSystem* trailParticles; 39 static ParticleSystem* explosionParticles; 40 41 ParticleEmitter* emitter; 35 42 36 43 }; -
branches/world_entities/src/world_entities/weapons/cannon.cc
r5623 r5744 78 78 this->loadModel("models/guns/cannon.obj"); 79 79 80 this->setStateDuration(WS_SHOOTING, .1);80 this->setStateDuration(WS_SHOOTING, 2.0); 81 81 this->setStateDuration(WS_RELOADING, .1); 82 this->setStateDuration(WS_ACTIVATING, . 4);82 this->setStateDuration(WS_ACTIVATING, .1); 83 83 this->setStateDuration(WS_DEACTIVATING, .4); 84 84 85 this->setMaximumEnergy(100 0, 100);86 this->increaseEnergy( 1000);85 this->setMaximumEnergy(100, 1); 86 this->increaseEnergy(30); 87 87 //this->minCharge = 2; 88 88 … … 90 90 91 91 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 92 this->setProjectileType(CL_ LASER);93 this->prepareProjectiles( 20);92 this->setProjectileType(CL_BOMB); 93 this->prepareProjectiles(5); 94 94 95 95 // this->objectComponent1 = new PNode(); … … 163 163 pj->setParent(NullParent::getInstance()); 164 164 165 pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))* 50+VECTOR_RAND(5));165 pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*15+VECTOR_RAND(5)); 166 166 167 167 pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset
for help on using the changeset viewer.