Changeset 3646 in orxonox.OLD for orxonox/trunk/src/world_entities/projectile.cc
- Timestamp:
- Mar 23, 2005, 5:43:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/projectile.cc
r3633 r3646 20 20 21 21 #include "world_entity.h" 22 #include "null_parent.h" 22 23 #include "objModel.h" 23 24 #include "primitive.h" … … 35 36 this->projectileModel = new Primitive(P_SPHERE); 36 37 this->flightDirection = NULL; 38 this->currentLifeTime = 0.0f; 39 this->ttl = 1.0f; 37 40 this->speed = 1.1f; 38 41 } … … 69 72 70 73 /** 74 \brief this sets the time to life of the projectile 75 \param ttl in second 76 77 after this life time, the projectile will garbage collect itself 78 */ 79 void Projectile::setTTL(float ttl) 80 { 81 this->ttl = ttl; 82 } 83 84 85 /** 71 86 \brief signal tick, time dependent things will be handled here 72 87 \param time since last tick … … 74 89 void Projectile::tick (float time) 75 90 { 76 *this->flightDirection = *this->flightDirection * speed; 77 this->shiftCoor(this->flightDirection); 91 this->currentLifeTime += time; 92 if( this->ttl < this->currentLifeTime) 93 { 94 *this->flightDirection = *this->flightDirection * speed; 95 this->shiftCoor(this->flightDirection); 96 return; 97 } 98 this->finalize(); 99 //NullParent* np = NullParent::getInstance(); 100 /* garbage colelction */ 101 // \fix: there is no gc in this class, its all been done by GarbageCollector 78 102 } 79 103
Note: See TracChangeset
for help on using the changeset viewer.