Changeset 1747 for code/trunk/src/orxonox/objects/Projectile.cc
- Timestamp:
- Sep 9, 2008, 4:25:52 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core3 (added) merged: 1573-1574,1583-1586,1591-1594,1596-1597,1603,1606-1607,1610-1611,1655,1658,1676-1679,1681-1685,1687,1716-1723,1725-1729,1736
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/Projectile.cc
r1602 r1747 35 35 #include "core/Executor.h" 36 36 #include "core/ConfigValueIncludes.h" 37 #include "core/Iterator.h" 37 38 #include "tools/ParticleInterface.h" 38 39 … … 43 44 namespace orxonox 44 45 { 45 float Projectile::speed_ = 5000;46 float Projectile::speed_s = 5000; 46 47 47 48 Projectile::Projectile(SpaceShip* owner) : owner_(owner) … … 73 74 SetConfigValue(damage_, 15.0).description("The damage caused by the projectile"); 74 75 SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive"); 75 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second"); 76 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged); 77 } 76 78 77 if(this->owner_) 78 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 79 void Projectile::speedChanged() 80 { 81 Projectile::speed_s = this->speed_; 82 if (this->owner_) 83 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 79 84 } 80 85 81 86 void Projectile::tick(float dt) 82 87 { 83 WorldEntity::tick(dt);88 SUPER(Projectile, tick, dt); 84 89 85 90 if (!this->isActive()) … … 87 92 88 93 float radius; 89 for ( Iterator<Model> it = ObjectList<Model>::start(); it; ++it)94 for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it) 90 95 { 91 96 if ((*it) != this->owner_) 92 97 { 93 radius = it->getScale ().x * 3.0;98 radius = it->getScale3D().x * 3.0; 94 99 95 100 if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius))
Note: See TracChangeset
for help on using the changeset viewer.