- Timestamp:
- Aug 22, 2011, 3:05:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r8706 r8855 21 21 * 22 22 * Author: 23 * Gabriel Nadler 24 * Co-authors: 23 25 * Oliver Scheuss 24 * Co-authors:25 26 * simonmie 26 27 * 27 28 */ 28 29 30 /** 31 @file BasicProjectile.h 32 @brief Implementation of the BasicProjectile class. 33 */ 34 29 35 #include "SimpleRocketFire.h" 30 36 37 #include "core/CoreIncludes.h" 31 38 #include "util/Math.h" 32 #include "core/CoreIncludes.h"33 #include "weapons/RocketController.h"34 39 35 40 #include "weaponsystem/Weapon.h" … … 38 43 #include "worldentities/pawns/Pawn.h" 39 44 #include "sound/WorldSound.h" 45 46 #include "weapons/RocketController.h" 47 #include "weapons/projectiles/SimpleRocket.h" 40 48 41 49 namespace orxonox … … 48 56 RegisterObject(SimpleRocketFire); 49 57 50 this->reloadTime_ = 1 ;58 this->reloadTime_ = 1.0f; 51 59 this->bParallelReload_ = false; 52 this->damage_ = 0 ;53 this->speed_ = 500 ;60 this->damage_ = 0.0f; 61 this->speed_ = 500.0f; 54 62 55 63 this->setMunitionName("RocketMunition"); … … 62 70 } 63 71 64 /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target 65 */ 72 /** 73 @brief 74 Fires the weapon. Creates the SimpleRocket and a RocketController to steer it and fires it. 75 */ 66 76 void SimpleRocketFire::fire() 67 77 { 68 RocketController* con = new RocketController(this);69 SimpleRocket* rocket = con ->getRocket();78 RocketController* controller = new RocketController(this); 79 SimpleRocket* rocket = controller->getRocket(); 70 80 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 71 81 rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation()); 72 82 rocket->setPosition(this->getMuzzlePosition()); 73 83 rocket->setVelocity(this->getMuzzleDirection()*this->speed_); 74 rocket->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());84 rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 75 85 76 86 rocket->setDamage(this->damage_); … … 78 88 rocket->setHealthDamage(this->getHealthDamage()); 79 89 80 WorldEntity* pawn n=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();81 if (pawn n) con->setTarget(pawnn);90 WorldEntity* pawn = static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget(); 91 if (pawn) controller->setTarget(pawn); 82 92 } 83 93 }
Note: See TracChangeset
for help on using the changeset viewer.