Changeset 9165 in orxonox.OLD for branches/presentation/src
- Timestamp:
- Jul 4, 2006, 7:07:09 PM (18 years ago)
- Location:
- branches/presentation/src/world_entities/projectiles
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/projectiles/rail_projectiles.cc
r9164 r9165 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 17 17 18 #include " laser.h"18 #include "rail_projectile.h" 19 19 20 20 #include "state.h" … … 30 30 using namespace std; 31 31 32 CREATE_FAST_FACTORY_STATIC( Laser, CL_LASER);32 CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE); 33 33 34 34 /** 35 35 * standard constructor 36 36 */ 37 Laser::Laser() : Projectile()37 RailProjectile::RailProjectile () : Projectile() 38 38 { 39 this->setClassID(CL_ LASER, "Laser");39 this->setClassID(CL_RAIL_PROJECTILE, "RailProjectile"); 40 40 41 this->loadModel("models/projectiles/ laser.obj");41 this->loadModel("models/projectiles/rail_projectile.obj"); 42 42 43 43 this->setMinEnergy(10); … … 56 56 * standard deconstructor 57 57 */ 58 Laser::~Laser()58 RailProjectile::~RailProjectile () 59 59 { 60 60 // delete this->emitter; 61 61 62 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 63 if ( Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1)63 if (RailProjectile::explosionParticles != NULL && ClassList::getList(CL_RAIL_PROJECTILE)->size() <= 1) 64 64 { 65 //if (ClassList::exists( Laser::explosionParticles, CL_PARTICLE_SYSTEM))66 // delete Laser::explosionParticles;67 PRINTF(1)("Deleting LaserParticles\n");68 Laser::explosionParticles = NULL;65 //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM)) 66 // delete RailProjectile::explosionParticles; 67 PRINTF(1)("Deleting RailProjectile Particles\n"); 68 RailProjectile::explosionParticles = NULL; 69 69 } 70 70 71 71 } 72 72 73 SpriteParticles* Laser::explosionParticles = NULL;73 SpriteParticles* RailProjectile::explosionParticles = NULL; 74 74 75 void Laser::activate()75 void RailProjectile::activate() 76 76 { 77 if (unlikely( Laser::explosionParticles == NULL))77 if (unlikely(RailProjectile::explosionParticles == NULL)) 78 78 { 79 Laser::explosionParticles = new SpriteParticles(1000);80 Laser::explosionParticles->setName("LaserExplosionParticles");81 Laser::explosionParticles->setLifeSpan(.5, .3);82 Laser::explosionParticles->setRadius(0.0, 10.0);83 Laser::explosionParticles->setRadius(.5, 6.0);84 Laser::explosionParticles->setRadius(1.0, 3.0);85 Laser::explosionParticles->setColor(0.0, 1,1,0,.9);86 Laser::explosionParticles->setColor(0.5, .8,.8,0,.5);87 Laser::explosionParticles->setColor(1.0, .8,.8,.7,.0);79 RailProjectile::explosionParticles = new SpriteParticles(1000); 80 RailProjectile::explosionParticles->setName("RailProjectileExplosionParticles"); 81 RailProjectile::explosionParticles->setLifeSpan(.5, .3); 82 RailProjectile::explosionParticles->setRadius(0.0, 10.0); 83 RailProjectile::explosionParticles->setRadius(.5, 6.0); 84 RailProjectile::explosionParticles->setRadius(1.0, 3.0); 85 RailProjectile::explosionParticles->setColor(0.0, 1,1,0,.9); 86 RailProjectile::explosionParticles->setColor(0.5, .8,.8,0,.5); 87 RailProjectile::explosionParticles->setColor(1.0, .8,.8,.7,.0); 88 88 } 89 89 … … 92 92 93 93 94 void Laser::deactivate()94 void RailProjectile::deactivate() 95 95 { 96 assert ( Laser::explosionParticles != NULL);97 Laser::explosionParticles->removeEmitter(this->emitter);96 assert (RailProjectile::explosionParticles != NULL); 97 RailProjectile::explosionParticles->removeEmitter(this->emitter); 98 98 this->lifeCycle = 0.0; 99 99 100 100 this->toList(OM_NULL); 101 101 this->removeNode(); 102 Laser::fastFactory->kill(this);102 RailProjectile::fastFactory->kill(this); 103 103 } 104 104 105 105 106 void Laser::collidesWith(WorldEntity* entity, const Vector& location)106 void RailProjectile::collidesWith(WorldEntity* entity, const Vector& location) 107 107 { 108 108 if (this->hitEntity != entity && entity->isA(CL_NPC)) … … 115 115 * @param dt time since last tick 116 116 */ 117 void Laser::tick (float dt)117 void RailProjectile::tick (float dt) 118 118 { 119 119 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); … … 128 128 * the function gets called, when the projectile is destroyed 129 129 */ 130 void Laser::destroy (WorldEntity* killer)130 void RailProjectile::destroy (WorldEntity* killer) 131 131 { 132 132 Projectile::destroy( killer ); 133 PRINTF(5)("DESTROY Laser\n");133 PRINTF(5)("DESTROY RailProjectile\n"); 134 134 this->lifeCycle = .95; //!< @todo calculate this usefully. 135 135 136 this->emitter->setSystem( Laser::explosionParticles);136 this->emitter->setSystem(RailProjectile::explosionParticles); 137 137 } 138 138 139 139 140 void Laser::draw () const140 void RailProjectile::draw () const 141 141 { 142 142 glPushAttrib(GL_ENABLE_BIT); -
branches/presentation/src/world_entities/projectiles/rail_projectiles.h
r9164 r9165 1 1 /*! 2 * @file laser.h2 * @file rail_projectile.h 3 3 * @brief a projectile, that is been shooted by a weapon 4 4 */ 5 5 6 #ifndef _ LASER_H7 #define _ LASER_H6 #ifndef _RAIL_PROJECTILE_H 7 #define _RAIL_PROJECTILE_H 8 8 9 9 #include "projectile.h" … … 15 15 class FastFactory; 16 16 17 class Laser: public Projectile17 class RailProjectile : public Projectile 18 18 { 19 19 public: 20 Laser();21 virtual ~ Laser();20 RailProjectile (); 21 virtual ~RailProjectile (); 22 22 23 23 … … 44 44 }; 45 45 46 #endif /* _ LASER_H */46 #endif /* _RAIL_PROJECTILE_H */
Note: See TracChangeset
for help on using the changeset viewer.