- Timestamp:
- Aug 22, 2011, 3:05:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file EnergyDrink.h 31 @brief Implementation of the EnergyDrink class. 32 */ 33 29 34 #include "EnergyDrink.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" 40 43 #include "weaponsystem/WeaponSystem.h" 41 44 #include "worldentities/pawns/Pawn.h" 45 46 #include "weapons/projectiles/Projectile.h" 47 #include "weapons/MuzzleFlash.h" 42 48 43 49 namespace orxonox … … 49 55 RegisterObject(EnergyDrink); 50 56 51 this->reloadTime_ = 0.25 ;52 this->damage_ = 0 ; //default 1553 this->speed_ = 2500 ;54 this->delay_ = 0 ;57 this->reloadTime_ = 0.25f; 58 this->damage_ = 0.0f; 59 this->speed_ = 2500.0f; 60 this->delay_ = 0.0f; 55 61 this->setMunitionName("FusionMunition"); 56 62 … … 65 71 XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode); 66 72 XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode); 67 68 73 } 69 74 70 void EnergyDrink::setMaterial(const std::string& material) 75 /** 76 @brief 77 Sets the delay with which is fired. 78 @param delay 79 The delay in seconds. 80 */ 81 void EnergyDrink::setDelay(float delay) 71 82 { 72 this->material_ = material; 73 } 74 75 void EnergyDrink::setDelay(float d) 76 { 77 this->delay_ = d; 83 this->delay_ = delay; 78 84 this->delayTimer_.setInterval(this->delay_); 79 85 } 80 86 81 float EnergyDrink::getDelay() const 82 { 83 return this->delay_; 84 } 85 87 /** 88 @brief 89 Fires the weapon. 90 */ 86 91 void EnergyDrink::fire() 87 92 { … … 89 94 } 90 95 91 void EnergyDrink::muendungsfeuer() 92 { 93 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 94 this->getWeapon()->attach(muzzleFlash); 95 muzzleFlash->setPosition(this->getMuzzleOffset()); 96 muzzleFlash->setMaterial(this->material_); 97 } 98 99 /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer() 100 */ 96 /** 97 @brief 98 Executes the shot, be creating the projectile and sending it on its way. 99 */ 101 100 void EnergyDrink::shot() 102 101 { 102 // Create the projectile 103 103 Projectile* projectile = new Projectile(this); 104 104 Model* model = new Model(projectile); … … 112 112 projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_); 113 113 114 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());114 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 115 115 projectile->setDamage(this->getDamage()); 116 116 projectile->setShieldDamage(this->getShieldDamage()); 117 117 projectile->setHealthDamage(this->getHealthDamage()); 118 118 119 EnergyDrink::muendungsfeuer(); 119 // Display a muzzle flash. 120 this->muzzleflash(); 121 } 122 123 /** 124 @brief 125 Displays a muzzle flash. 126 */ 127 void EnergyDrink::muzzleflash() 128 { 129 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 130 this->getWeapon()->attach(muzzleFlash); 131 muzzleFlash->setPosition(this->getMuzzleOffset()); 132 muzzleFlash->setMaterial(this->material_); 120 133 } 121 134 }
Note: See TracChangeset
for help on using the changeset viewer.