Changeset 6056 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Dec 11, 2005, 10:47:01 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/guided_missile.cc
r6054 r6056 134 134 // GarbageCollector::getInstance()->collect(this); 135 135 State::getWorldEntityList()->remove(this); 136 this->removeNode(); 136 137 GuidedMissile::fastFactory->kill(this); 137 138 } … … 164 165 this->shiftCoor(v); 165 166 166 this->lifeCycle += time/this->lifeSpan; 167 if( this->lifeCycle >= 1.0) 168 { 169 PRINTF(5)("FINALIZE==========================\n"); 170 PRINTF(5)("current life cycle is: %f\n", this->lifeCycle); 171 PRINTF(5)("FINALIZE===========================\n"); 172 173 this->deactivate(); 174 } 167 if(this->tickLifeCycle(time)) 168 this->deactivate(); 175 169 } 176 170 -
trunk/src/world_entities/weapons/laser.cc
r5994 r6056 100 100 // GarbageCollector::getInstance()->collect(this); 101 101 State::getWorldEntityList()->remove(this); 102 this->removeNode(); 102 103 Laser::fastFactory->kill(this); 103 104 } … … 113 114 /** 114 115 * signal tick, time dependent things will be handled here 115 * @param time since last tick116 * @param dt time since last tick 116 117 */ 117 void Laser::tick (float time)118 void Laser::tick (float dt) 118 119 { 119 120 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 120 Vector v = this->velocity * (time);121 Vector v = this->velocity * dt; 121 122 this->shiftCoor(v); 122 123 123 this->lifeCycle += time/this->lifeSpan; 124 if( this->lifeCycle >= 1.0) 125 { 126 PRINTF(5)("FINALIZE==========================\n"); 127 PRINTF(5)("current life cycle is: %f\n", this->lifeCycle); 128 PRINTF(5)("FINALIZE===========================\n"); 129 130 this->deactivate(); 131 } 124 if (this->tickLifeCycle(dt)) 125 this->deactivate(); 132 126 } 133 127 -
trunk/src/world_entities/weapons/laser.h
r5750 r6056 29 29 virtual void destroy (); 30 30 31 virtual void tick (float time);31 virtual void tick (float dt); 32 32 virtual void draw () const; 33 33 -
trunk/src/world_entities/weapons/projectile.cc
r6054 r6056 110 110 /** 111 111 * signal tick, time dependent things will be handled here 112 * @param timesince last tick112 * @param dt since last tick 113 113 */ 114 void Projectile::tick (float time)114 void Projectile::tick (float dt) 115 115 { 116 Vector v = this->velocity * ( time);116 Vector v = this->velocity * (dt); 117 117 this->shiftCoor(v); 118 118 119 this->lifeCycle += time/this->lifeSpan; 120 if( this->lifeCycle >= 1) 121 { 122 PRINTF(5)("FINALIZE==========================\n"); 123 PRINTF(5)("current life cycle is: %f\n", this->lifeCycle); 124 PRINTF(5)("FINALIZE===========================\n"); 125 //this->finalize(); 126 GarbageCollector::getInstance()->collect(this); 127 } 119 if (this->tickLifeCycle(dt)) 120 this->destroy(); 128 121 } 129 122 -
trunk/src/world_entities/weapons/projectile.h
r6054 r6056 40 40 virtual void destroy (); 41 41 42 virtual void tick (float time); 42 virtual void tick (float dt); 43 /** @brief convenience function 44 * @param dt the Time passed 45 * @returns true if the Projectile is past its lifeTime, false if it shall still live */ 46 inline bool tickLifeCycle(float dt ) { this->lifeCycle += dt/this->lifeSpan; return(unlikely(this->lifeCycle >= 1)); } 47 43 48 44 49 protected: -
trunk/src/world_entities/weapons/rocket.cc
r5994 r6056 143 143 * @param time since last tick 144 144 */ 145 void Rocket::tick (float time)145 void Rocket::tick (float dt) 146 146 { 147 147 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 148 Vector v = this->velocity * ( time);148 Vector v = this->velocity * (dt); 149 149 this->shiftCoor(v); 150 150 151 this->lifeCycle += time/this->lifeSpan; 152 if( this->lifeCycle >= 1.0) 153 { 154 PRINTF(5)("FINALIZE==========================\n"); 155 PRINTF(5)("current life cycle is: %f\n", this->lifeCycle); 156 PRINTF(5)("FINALIZE===========================\n"); 157 158 this->deactivate(); 159 } 151 if(this->tickLifeCycle(dt)) 152 this->deactivate(); 160 153 } 161 154 -
trunk/src/world_entities/weapons/weapon_manager.cc
r6055 r6056 90 90 } 91 91 this->currentSlotConfig[i].position.setName(tmpName); 92 this->currentSlotConfig[i].position.deactivateNode(); 92 93 delete[] tmpName; 93 94 }
Note: See TracChangeset
for help on using the changeset viewer.