Changeset 1596 for code/branches/core3/src/orxonox/objects
- Timestamp:
- Jun 12, 2008, 10:53:51 PM (16 years ago)
- Location:
- code/branches/core3/src/orxonox/objects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/orxonox/objects/ParticleProjectile.cc
r1563 r1596 32 32 #include "SpaceShip.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" 35 35 namespace orxonox 36 36 { … … 52 52 this->particles_ = 0; 53 53 } 54 55 this->setConfigValues(); 54 56 } 55 57 … … 60 62 } 61 63 64 void ParticleProjectile::setConfigValues() 65 { 66 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(&ParticleProjectile::speedChanged); 67 } 68 69 void ParticleProjectile::speedChanged() 70 { 71 Projectile::speed_s = this->speed_; 72 if (this->owner_) 73 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 74 } 75 62 76 void ParticleProjectile::changedVisibility() 63 77 { -
code/branches/core3/src/orxonox/objects/ParticleProjectile.h
r1558 r1596 44 44 virtual ~ParticleProjectile(); 45 45 virtual void changedVisibility(); 46 void setConfigValues(); 47 void speedChanged(); 46 48 47 49 private: -
code/branches/core3/src/orxonox/objects/Projectile.cc
r1592 r1596 44 44 namespace orxonox 45 45 { 46 float Projectile::speed_ = 5000;46 float Projectile::speed_s = 5000; 47 47 48 48 Projectile::Projectile(SpaceShip* owner) : owner_(owner) … … 74 74 SetConfigValue(damage_, 15.0).description("The damage caused by the projectile"); 75 75 SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive"); 76 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(&Projectile::speedChanged); 77 } 77 78 79 void Projectile::speedChanged() 80 { 81 Projectile::speed_s = this->speed_; 78 82 if (this->owner_) 79 83 this->setVelocity(this->owner_->getInitialDir() * this->speed_); -
code/branches/core3/src/orxonox/objects/Projectile.h
r1552 r1596 42 42 virtual ~Projectile(); 43 43 void setConfigValues(); 44 void speedChanged(); 44 45 void destroyObject(); 45 46 virtual void tick(float dt); 46 47 47 48 static float getSpeed() 48 { return Projectile::speed_ ; }49 { return Projectile::speed_s; } 49 50 50 51 protected: … … 55 56 std::string explosionTemplateName_; 56 57 std::string smokeTemplateName_; 57 static float speed_; 58 protected: 59 static float speed_s; 60 float speed_; 61 private: 58 62 float lifetime_; 59 63 float damage_; -
code/branches/core3/src/orxonox/objects/RotatingProjectile.cc
r1584 r1596 65 65 void RotatingProjectile::setConfigValues() 66 66 { 67 SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0)); 67 SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0)).callback(&RotatingProjectile::colourChanged); 68 } 68 69 70 void RotatingProjectile::colourChanged() 71 { 69 72 if (this->isInitialized()) 70 73 { -
code/branches/core3/src/orxonox/objects/RotatingProjectile.h
r1558 r1596 14 14 virtual ~RotatingProjectile(); 15 15 void setConfigValues(); 16 void colourChanged(); 16 17 virtual void tick(float dt); 17 18 virtual void changedVisibility();
Note: See TracChangeset
for help on using the changeset viewer.