- Timestamp:
- Nov 30, 2005, 12:14:15 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/object_manager.cc
r5826 r5828 62 62 list<BaseObject*>::const_iterator node; 63 63 for (node = objectList->begin(); node != objectList->end(); node++) 64 {65 64 if ((dynamic_cast<PNode*>(*node)->getAbsCoor() - center.getAbsCoor()).len() < radius) 66 65 newList->push_back(dynamic_cast<WorldEntity*>(*node)); 67 }68 66 return newList; 69 67 } -
trunk/src/world_entities/weapons/bomb.cc
r5826 r5828 18 18 #include "state.h" 19 19 #include "model.h" 20 #include "primitive_model.h" 21 20 22 #include "fast_factory.h" 21 23 #include "list.h" … … 59 61 Bomb::~Bomb () 60 62 { 63 delete this->detonationSphere; 64 delete this->detonationMaterial; 61 65 62 66 } … … 71 75 this->setClassID(CL_BOMB, "Bomb"); 72 76 77 78 this->detonationSphere = new PrimitiveModel(PRIM_SPHERE); 79 this->detonationMaterial = new Material(); 80 this->detonationMaterial->setDiffuse(1, 0, 0); 81 // this->detonationMaterial->setTransparency(.1); 73 82 /** 74 83 * @todo: Write CL_PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition) … … 101 110 void Bomb::tick(float time) 102 111 { 103 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);104 Vector v = this->velocity * (time);105 this->shiftCoor(v);106 107 112 this->lifeCycle += time/this->lifeSpan; 108 113 if( this->lifeCycle >= 1.0) … … 114 119 this->deactivate(); 115 120 } 116 if (this->lifeCycle > 0.9f) 117 this->detonate ((this->lifeCycle-.89) *10000.0); 121 else if (this->lifeCycle > 0.9f) 122 this->detonate ((this->lifeCycle-.89) *1000.0); 123 else 124 { 125 Vector v = this->velocity * (time); 126 this->shiftCoor(v); 127 } 118 128 } 119 129 … … 135 145 glMultMatrixf((float*)matrix); 136 146 137 if (model) 138 model->draw(); 147 if (this->lifeCycle < .9) 148 { 149 if (model) 150 model->draw(); 151 } 152 else 153 { 154 glScalef((this->lifeCycle-.89) *1000.0, 155 (this->lifeCycle-.89) *1000.0, 156 (this->lifeCycle-.89) *1000.0); 157 this->detonationMaterial->select(); 158 this->detonationSphere->draw(); 159 } 139 160 glPopMatrix(); 140 161 } … … 147 168 void Bomb::collidesWith (WorldEntity* entity, const Vector& location) 148 169 { 149 if ( entity->isA(CL_NPC))150 this->life Span= 0.9f;170 if (this->lifeCycle < .9f && entity->isA(CL_NPC)) 171 this->lifeCycle = 0.9f; 151 172 } 152 173 … … 160 181 { 161 182 State::getWorldEntityList()->remove(this); 183 this->lifeCycle = 0.0f; 162 184 Bomb::fastFactory->kill(this); 163 185 } … … 170 192 while( !detonationList->empty() ) 171 193 { 172 //detonationList->front()->collidesWith(this, Vector(0,0,0));194 detonationList->front()->collidesWith(this, Vector(0,0,0)); 173 195 detonationList->pop_front(); 174 196 } -
trunk/src/world_entities/weapons/bomb.h
r5826 r5828 8 8 9 9 #include "projectile.h" 10 10 11 class FastFactory; 11 12 class ParticleSystem; 12 13 class ParticleEmitter; 14 class Material; 13 15 14 16 //! A Class to ... … … 41 43 42 44 ParticleEmitter* emitter; 43 45 Model* detonationSphere; 46 Material* detonationMaterial; 44 47 }; 45 48 -
trunk/src/world_entities/weapons/cannon.cc
r5819 r5828 83 83 this->setStateDuration(WS_DEACTIVATING, .4); 84 84 85 this->setMaximumEnergy(100, 1);86 this->increaseEnergy( 30);85 this->setMaximumEnergy(100, 20); 86 this->increaseEnergy(100); 87 87 //this->minCharge = 2; 88 88
Note: See TracChangeset
for help on using the changeset viewer.