Changeset 6417 for code/trunk/src/modules/weapons
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 9 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
r5781 r6417 4 4 Projectile.cc 5 5 LightningGunProjectile.cc 6 Rocket.cc 6 7 ) -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
r5929 r6417 43 43 this->maxTextureIndex_ = 8; 44 44 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); 45 45 46 46 registerVariables(); 47 47 } 48 48 49 49 void LightningGunProjectile::registerVariables() 50 50 { 51 51 registerVariable(this->materialBase_); 52 52 } 53 53 54 54 void LightningGunProjectile::setMaterial(const std::string& material) 55 55 { 56 this->materialBase_ = material; 57 56 this->materialBase_ = material; 57 58 58 BillboardProjectile::setMaterial(material + multi_cast<std::string>(this->textureIndex_)); 59 59 } … … 64 64 if (this->textureIndex_ > this->maxTextureIndex_) 65 65 this->textureIndex_ = 1; 66 66 67 67 this->setMaterial(this->materialBase_); 68 68 } -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r5929 r6417 48 48 this->bDestroy_ = false; 49 49 this->owner_ = 0; 50 this->damage_ = 15; 50 51 51 52 // Get notification about collisions … … 53 54 if (GameMode::isMaster()) 54 55 { 56 this->setMass(1.0); 55 57 this->enableCollisionCallback(); 56 58 this->setCollisionResponse(false); … … 71 73 void Projectile::setConfigValues() 72 74 { 73 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 76 } … … 128 129 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 129 130 if (victim) 130 victim-> damage(dmg, this->owner_);131 victim->hit(this->owner_, contactPoint, dmg); 131 132 } 132 133 return false; -
code/trunk/src/modules/weapons/weaponmodes/CMakeLists.txt
r5781 r6417 5 5 HsW01.cc 6 6 LightningGun.cc 7 RocketFire.cc 7 8 ) -
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
r5929 r6417 39 39 #include "weaponsystem/WeaponPack.h" 40 40 #include "weaponsystem/WeaponSystem.h" 41 #include "worldentities/WorldEntity.h" 42 #include "worldentities/pawns/Pawn.h" 41 43 42 44 namespace orxonox … … 56 58 this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&HsW01::shot, this))); 57 59 this->delayTimer_.stopTimer(); 60 61 this->setDefaultSound("sounds/Weapon_HsW01.ogg"); 62 } 63 64 HsW01::~HsW01() 65 { 58 66 } 59 67 … … 103 111 void HsW01::shot() 104 112 { 113 assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() ); 105 114 Projectile* projectile = new Projectile(this); 106 115 Model* model = new Model(projectile); … … 110 119 model->setScale(5); 111 120 121 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 112 122 projectile->setOrientation(this->getMuzzleOrientation()); 113 123 projectile->setPosition(this->getMuzzlePosition()); -
code/trunk/src/modules/weapons/weaponmodes/HsW01.h
r5929 r6417 41 41 public: 42 42 HsW01(BaseObject* creator); 43 virtual ~HsW01() {}43 virtual ~HsW01(); 44 44 45 45 virtual void fire(); -
code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
r5781 r6417 34 34 #include "weaponsystem/WeaponPack.h" 35 35 #include "weaponsystem/WeaponSystem.h" 36 #include "worldentities/pawns/Pawn.h" 36 37 37 38 namespace orxonox … … 48 49 49 50 this->setMunitionName("LaserMunition"); 51 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 50 52 } 51 53 … … 59 61 projectile->setMaterial("Flares/LightningBall_"); 60 62 63 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 61 64 projectile->setOrientation(this->getMuzzleOrientation()); 62 65 projectile->setPosition(this->getMuzzlePosition()); -
code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
r5781 r6417 42 42 43 43 virtual void fire(); 44 44 45 private: 45 46 float speed_;
Note: See TracChangeset
for help on using the changeset viewer.