Changeset 8855 for code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
- Timestamp:
- Aug 22, 2011, 3:05:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file HsW01.h 31 @brief Implementation of the HsW01 class. 32 */ 33 29 34 #include "HsW01.h" 30 35 … … 32 37 #include "core/XMLPort.h" 33 38 #include "core/command/Executor.h" 39 34 40 #include "graphics/Model.h" 35 36 #include "weapons/projectiles/Projectile.h"37 #include "weapons/MuzzleFlash.h"38 41 #include "weaponsystem/Weapon.h" 39 42 #include "weaponsystem/WeaponPack.h" … … 41 44 #include "worldentities/WorldEntity.h" 42 45 #include "worldentities/pawns/Pawn.h" 46 47 #include "weapons/projectiles/Projectile.h" 48 #include "weapons/MuzzleFlash.h" 43 49 44 50 namespace orxonox … … 50 56 RegisterObject(HsW01); 51 57 52 this->reloadTime_ = 0.25 ;53 this->damage_ = 0 ; //default 1554 this->speed_ = 2500 ;55 this->delay_ = 0 ;58 this->reloadTime_ = 0.25f; 59 this->damage_ = 0.0f; //default 15 60 this->speed_ = 2500.0f; 61 this->delay_ = 0.0f; 56 62 this->setMunitionName("LaserMunition"); 57 63 … … 72 78 XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode); 73 79 XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode); 74 75 80 } 76 81 77 void HsW01::setMaterial(const std::string& material) 82 /** 83 @brief 84 Set the firing delay. 85 @param delay 86 The firing delay in seconds. 87 */ 88 void HsW01::setDelay(float delay) 78 89 { 79 this->material_ = material; 80 } 81 82 std::string& HsW01::getMaterial() 83 { 84 return this->material_; 85 } 86 87 void HsW01::setDelay(float d) 88 { 89 this->delay_ = d; 90 this->delay_ = delay; 90 91 this->delayTimer_.setInterval(this->delay_); 91 }92 93 float HsW01::getDelay() const94 {95 return this->delay_;96 92 } 97 93 … … 101 97 } 102 98 103 void HsW01::muendungsfeuer() 104 { 105 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 106 this->getWeapon()->attach(muzzleFlash); 107 muzzleFlash->setPosition(this->getMuzzleOffset()); 108 muzzleFlash->setMaterial(this->material_); 109 } 110 111 /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer() 112 */ 99 /** 100 @brief 101 Fires the weapon. Creates a projectile and fires it. 102 */ 113 103 void HsW01::shot() 114 104 { 115 105 assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() ); 106 107 // Create the projectile. 116 108 Projectile* projectile = new Projectile(this); 117 109 Model* model = new Model(projectile); … … 126 118 projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_); 127 119 128 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());120 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 129 121 projectile->setDamage(this->getDamage()); 130 122 projectile->setShieldDamage(this->getShieldDamage()); 131 123 projectile->setHealthDamage(this->getHealthDamage()); 132 124 133 HsW01::muendungsfeuer(); 125 // Display the muzzle flash. 126 this->HsW01::muzzleflash(); 127 } 128 129 /** 130 @brief 131 Displays the muzzle flash. 132 */ 133 void HsW01::muzzleflash() 134 { 135 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 136 this->getWeapon()->attach(muzzleFlash); 137 muzzleFlash->setPosition(this->getMuzzleOffset()); 138 muzzleFlash->setMaterial(this->material_); 134 139 } 135 140 }
Note: See TracChangeset
for help on using the changeset viewer.