Changeset 10368 in orxonox.OLD for trunk/src/world_entities/projectiles
- Timestamp:
- Jan 25, 2007, 2:18:07 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
- 16 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 10 10 autom4te.cache 11 11 aclocal.m4 12 tags 13 test.bmp 14 config.sub 15 config.guess 16 OrxonoxPlayability.kdevses 17 OrxonoxPlayability.kdevelop.pcs
-
- Property svn:ignore
-
trunk/src/world_entities/projectiles/projectile.cc
r10013 r10368 25 25 #include "playable.h" 26 26 27 #include <cmath> 28 27 29 #include "debug.h" 28 30 … … 46 48 this->subscribeReaction( CoRe::CREngine::CR_PHYSICS_FULL_WALK, Playable::staticClassID()); 47 49 50 this->physDamage = 0.0f; 51 this->elecDamage = 0.0f; 48 52 //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 49 53 } … … 60 64 */ 61 65 //delete this->projectileModel; 66 } 67 68 Projectile::Projectile (float pDamage, float eDamage, PNode* target) : WorldEntity() 69 { 70 this->registerObject(this, Projectile::_objectList); 71 72 this->lifeCycle = 0.0; 73 this->lifeSpan = 1.0f; /* sec */ 74 this->removeNode(); 75 76 /* character attributes */ 77 this->setHealth(1.0f); 78 this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points 79 80 this->physDamage = pDamage; 81 this->elecDamage = eDamage; 82 this->target = target; 83 84 //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 85 } 86 87 void Projectile::initialize(float pDamage, float eDamage, PNode* target) 88 { 89 /* character attributes*/ 90 this->physDamage = pDamage; 91 this->elecDamage = eDamage; 92 this->target = target; 62 93 } 63 94 … … 124 155 125 156 157 void Projectile::collidesWith (WorldEntity* target, const Vector& location) 158 { 159 dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage()); 160 // this->destroy(NULL); 161 this->destroy(target); 162 } 163 164 165 126 166 /** 127 167 * signal tick, time dependent things will be handled here … … 130 170 void Projectile::tick (float dt) 131 171 { 132 Vector v = this->velocity * (dt);133 this->shiftCoor(v);134 135 172 if (this->tickLifeCycle(dt)) 136 173 this->destroy( NULL ); -
trunk/src/world_entities/projectiles/projectile.h
r9869 r10368 12 12 #include "world_entity.h" 13 13 #include "loading/fast_factory.h" 14 #include "space_ships/space_ship.h" 14 15 15 16 #include "sound_source.h" … … 22 23 Projectile (); 23 24 virtual ~Projectile (); 25 26 /** @brief Constructor with variable passing*/ 27 Projectile (float pDamage, float eDamage, PNode* target); 28 /** @brief for void construction; setting values later - needed for FastFactory*/ 29 virtual void initialize(float pDamage, float eDamage, PNode* target); 24 30 25 31 void setFlightDirection(const Quaternion& flightDirection); … … 44 50 virtual void destroy (WorldEntity* killer); 45 51 52 virtual void collidesWith (WorldEntity* target, const Vector& location); //!< collision handler; used against SpaceShip as most target will be 53 54 46 55 virtual void tick (float dt); 47 56 /** @brief convenience function … … 50 59 inline bool tickLifeCycle(float dt ) { this->lifeCycle += dt/this->lifeSpan; return(unlikely(this->lifeCycle >= 1)); } 51 60 61 inline float getPhysDamage() { return this->physDamage; }; 62 inline float getElecDamage() { return this->elecDamage; }; 63 64 inline void setPhysDamage( float dmg) {this->physDamage = dmg; }; 65 inline void setElecDamage( float dmg) {this->elecDamage = dmg; }; 52 66 53 67 protected: 54 68 // energy 55 float energyMin; //!< The minimal Energy a Projectile needs to be emitted. 56 bool bChargeable; //!< if the Projectile is Charegeable 69 int origList; //!< FIXME currently a fix around the collision seg fault 70 float energyMin; //!< The minimal Energy a Projectile needs to be emitted. 71 bool bChargeable; //!< if the Projectile is Charegeable 57 72 58 float lifeCycle;//!< The percentage of the Lifetime done [0-1]59 float lifeSpan;//!< The entire lifespan of the Shoot. in seconds73 float lifeCycle; //!< The percentage of the Lifetime done [0-1] 74 float lifeSpan; //!< The entire lifespan of the Shoot. in seconds 60 75 61 Vector flightDirection; //!< DOF direction in which the shoot flighs 76 float physDamage; //!< damage to shield and armor 77 float elecDamage; //!< damage to elctronic 78 float turningSpeed; //!< degrees per tick 62 79 63 Vector velocity; //!< velocity of the projectile.80 Vector flightDirection; //!< DOF direction in which the shoot flighs 64 81 65 PNode* target; //!< A target for guided Weapons. 82 Vector velocity; //!< velocity of the projectile. 83 84 PNode* target; //!< A target for guided Weapons. 66 85 67 86 OrxSound::SoundSource soundSource;
Note: See TracChangeset
for help on using the changeset viewer.