Changeset 10081 in orxonox.OLD for branches/playability/src/world_entities/projectiles
- Timestamp:
- Dec 16, 2006, 2:12:41 AM (18 years ago)
- Location:
- branches/playability/src/world_entities/projectiles
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/hbolt.cc
r10079 r10081 122 122 this->destroy( entity ); 123 123 this->hitEntity = entity; 124 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(),0);125 //this->deactivate();124 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 125 this->deactivate(); 126 126 } 127 127 -
branches/playability/src/world_entities/projectiles/mbolt.cc
r10078 r10081 34 34 #include "static_model.h" 35 35 36 #include "effects/trail.h" 37 36 38 37 39 #include "class_id_DEPRECATED.h" … … 46 48 this->registerObject(this, MBolt::_objectList); 47 49 this->loadModel("models/projectiles/mbolt.obj"); 50 48 51 49 52 //this->loadModel("models/projectiles/laser.obj"); … … 72 75 dynamic_cast<StaticModel*>(this->getModel())->addMaterial(this->mat); 73 76 dynamic_cast<StaticModel*>(this->getModel())->finalize(); 77 78 79 this->trail = new Trail(6,1,.4); 80 this->trail->setParent( this); 81 this->trail->setTexture( "maps/laser.png"); 74 82 } 75 83 … … 83 91 // delete this->emitter; 84 92 85 if (MBolt::trailParticles != NULL && MBolt::objectList().size() <= 1)86 {87 if (ParticleSystem::objectList().exists(MBolt::trailParticles))88 delete MBolt::trailParticles;89 MBolt::trailParticles = NULL;90 }91 93 if (MBolt::explosionParticles != NULL && MBolt::objectList().size() <= 1) 92 94 { … … 94 96 delete MBolt::explosionParticles; 95 97 MBolt::explosionParticles = NULL; 98 PRINTF(1)("Deleting MBolt Explosion Particles\n"); 96 99 } 97 } 98 99 SpriteParticles* MBolt::trailParticles = NULL; 100 101 } 102 100 103 SpriteParticles* MBolt::explosionParticles = NULL; 101 104 102 105 void MBolt::activate() 103 106 { 104 if (unlikely(MBolt::trailParticles == NULL))105 {106 MBolt::trailParticles = new SpriteParticles(1000);107 MBolt::trailParticles->setName("BoomerangProjectileTrailParticles");108 MBolt::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");109 MBolt::trailParticles->setLifeSpan(0.3, 0);110 MBolt::trailParticles->setRadius(0.0, .8);111 MBolt::trailParticles->setRadius(1.0, .2);112 MBolt::trailParticles->setColor(0.0, 1,0,0,.9);113 MBolt::trailParticles->setColor(0.2, .8,.2,0,.9);114 MBolt::trailParticles->setColor(0.5, .8,.4,.4,.8);115 MBolt::trailParticles->setColor(1.0, .8,.8,.8,.7);116 }117 107 if (unlikely(MBolt::explosionParticles == NULL)) 118 108 { … … 128 118 } 129 119 130 this->setDamage(10); 120 this->setPhysDamage(10); 121 this->setElecDamage(0); 131 122 this->setHealth(0); 132 123 133 this->emitter->setSystem(MBolt::trailParticles);134 124 135 125 this->emitter->setSpread(0); … … 142 132 void MBolt::deactivate() 143 133 { 144 assert (MBolt::trailParticles != NULL);145 MBolt::trailParticles->removeEmitter(this->emitter);146 147 134 assert (MBolt::explosionParticles != NULL); 148 135 MBolt::explosionParticles->removeEmitter(this->emitter); … … 157 144 void MBolt::collidesWith(WorldEntity* entity, const Vector& location) 158 145 { 159 if (this->hitEntity != entity && entity->isA(CL_NPC)) 160 this->destroy( entity ); 161 this->hitEntity = entity; 162 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 146 PRINTF(0)("MBolt collides pretest\n"); 147 if( entity == NULL || dynamic_cast<SpaceShip*>(entity) == NULL) 148 return; 149 150 PRINTF(0)("MBolt collides\n"); 151 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 152 entity->destroy(this); 153 this->deactivate(); 163 154 } 164 155 … … 177 168 178 169 this->angle += MBolt::rotationSpeed * dt; 170 this->trail->tick(dt); 179 171 } 180 172 … … 209 201 dynamic_cast<StaticModel*>(this->getModel())->draw(); 210 202 this->mat->unselect(); 203 glScalef(1/.75,4/.7,4/.7); 204 glTranslatef(-4,0,0); 205 this->trail->draw(); 211 206 glPopMatrix(); 212 207 glPopAttrib(); -
branches/playability/src/world_entities/projectiles/mbolt.h
r10064 r10081 15 15 class ParticleEmitter; 16 16 class FastFactory; 17 class Trail; 17 18 18 19 class MBolt : public Projectile … … 37 38 private: 38 39 static FastFactory* fastFactory; 39 static SpriteParticles* trailParticles;40 40 static SpriteParticles* explosionParticles; 41 42 Trail* trail; 41 43 42 44 float angle; -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10080 r10081 24 24 #include "particles/sprite_particles.h" 25 25 #include "space_ships/space_ship.h" 26 #include "effects/trail.h" 26 27 27 28 #include "debug.h" … … 57 58 58 59 this->physDamage = 200; 60 61 this->trail = new Trail(2.5,4,.2); 62 this->trail->setParent( this); 63 this->trail->setTexture( "maps/laser.png"); 59 64 } 60 65 … … 66 71 { 67 72 68 69 /* this is normaly done by World.cc by deleting the ParticleEngine */70 if (SwarmProjectile::trailParticles != NULL && SwarmProjectile::objectList().size() <= 1)71 {72 if (ParticleSystem::objectList().exists(SwarmProjectile::trailParticles))73 delete SwarmProjectile::trailParticles;74 SwarmProjectile::trailParticles = NULL;75 }76 73 if (SwarmProjectile::explosionParticles != NULL && SwarmProjectile::objectList().size() <= 1) 77 74 { … … 80 77 SwarmProjectile::explosionParticles = NULL; 81 78 } 82 delete this->emitter;83 } 84 85 SpriteParticles* SwarmProjectile::trailParticles = NULL; 79 // delete this->emitter; 80 delete this->trail; 81 } 82 86 83 SpriteParticles* SwarmProjectile::explosionParticles = NULL; 87 84 … … 90 87 void SwarmProjectile::activate() 91 88 { 92 if (unlikely(SwarmProjectile::trailParticles == NULL))93 {94 SwarmProjectile::trailParticles = new SpriteParticles(2000);95 SwarmProjectile::trailParticles->setName("SwarmProjectileTrailParticles");96 SwarmProjectile::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");97 SwarmProjectile::trailParticles->setLifeSpan(.3, 0);98 SwarmProjectile::trailParticles->setRadius(0.0, .7);99 SwarmProjectile::trailParticles->setRadius(0.2, 1.3);100 SwarmProjectile::trailParticles->setRadius(.5, .8);101 SwarmProjectile::trailParticles->setRadius(1.0, 0.3);102 SwarmProjectile::trailParticles->setColor(0.0, 1,0,0,.7);103 SwarmProjectile::trailParticles->setColor(0.2, .8,.8,0,.5);104 SwarmProjectile::trailParticles->setColor(0.5, .8,.8,.8,.8);105 SwarmProjectile::trailParticles->setColor(1.0, .8,.8,.8,.0);106 }107 89 if (unlikely(SwarmProjectile::explosionParticles == NULL)) 108 90 { … … 120 102 } 121 103 122 this->emitter->setSystem(SwarmProjectile::trailParticles);123 104 124 105 this->updateNode(0); … … 253 234 254 235 this->updateAngle(time); 236 237 this->trail->tick(time); 255 238 } 256 239 … … 291 274 //glScalef(2.0, 2.0, 2.0); // no double rescale 292 275 this->getModel()->draw(); 293 276 glTranslatef(-.9,0,0); 277 this->trail->draw(); 294 278 glPopMatrix(); 295 296 } 279 } -
branches/playability/src/world_entities/projectiles/swarm_projectile.h
r10080 r10081 14 14 class FastFactory; 15 15 class Aim; 16 class Trail; 16 17 17 18 class SwarmProjectile : public Projectile … … 36 37 private: 37 38 static FastFactory* fastFactory; 38 static SpriteParticles* trailParticles;39 39 static SpriteParticles* explosionParticles; 40 41 Trail* trail; 40 42 41 43 ParticleEmitter* emitter;
Note: See TracChangeset
for help on using the changeset viewer.