- Timestamp:
- Aug 22, 2011, 3:05:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
r8738 r8855 21 21 * 22 22 * Author: 23 * Oliver Scheuss23 * Gabriel Nadler 24 24 * Co-authors: 25 25 * simonmie 26 26 * 27 27 */ 28 29 /** 30 @file SimpleRocket.h 31 @brief Definition of the SimpleRocket class. 32 */ 28 33 29 34 #ifndef _SimpleRocket_H__ … … 33 38 34 39 #include "tools/Timer.h" 35 #include "worldentities/ControllableEntity.h" 40 36 41 #include "graphics/ParticleSpawner.h" 37 42 #include "interfaces/RadarViewable.h" 43 #include "worldentities/ControllableEntity.h" 38 44 39 45 #include "BasicProjectile.h" … … 45 51 /** 46 52 @brief 47 SimpleRocket, follows direction from a Rocketcontroller, has fuel for 80% of its lifetime, afterwards it's fire disappears. 53 SimpleRocket is a target seeking, intelligent rocket. It follows its target until it either hits something or runs out of fuel. 54 The steering is done by the RocketController. 48 55 @author 49 Gabriel Nadler (Original file: Oli Scheuss) 56 Gabriel Nadler 57 @ingroup WeaponsProjectiles 50 58 */ 51 59 class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable … … 55 63 virtual ~SimpleRocket(); 56 64 virtual void tick(float dt); 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.58 65 59 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 60 void destroyObject();61 67 62 68 void disableFire(); //!< Method to disable the fire and stop all acceleration … … 76 82 */ 77 83 inline void moveFrontBack(float value) 78 { this->moveFrontBack(Vector2(value, 0)); }84 { this->moveFrontBack(Vector2(value, 0)); } 79 85 /** 80 86 @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount. … … 82 88 */ 83 89 inline void moveRightLeft(float value) 84 { this->moveRightLeft(Vector2(value, 0)); }90 { this->moveRightLeft(Vector2(value, 0)); } 85 91 /** 86 92 @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount. … … 88 94 */ 89 95 inline void moveUpDown(float value) 90 { this->moveUpDown(Vector2(value, 0)); }96 { this->moveUpDown(Vector2(value, 0)); } 91 97 92 98 /** … … 95 101 */ 96 102 inline void rotateYaw(float value) 97 { this->rotateYaw(Vector2(value, 0)); }103 { this->rotateYaw(Vector2(value, 0)); } 98 104 /** 99 105 @brief Rotates the SimpleRocket around the x-axis by the specifed amount. … … 101 107 */ 102 108 inline void rotatePitch(float value) 103 { 104 this->rotatePitch(Vector2(value, 0)); } 109 { this->rotatePitch(Vector2(value, 0)); } 105 110 /** 106 111 @brief Rotates the SimpleRocket around the z-axis by the specifed amount. … … 108 113 */ 109 114 inline void rotateRoll(float value) 110 { 111 this->rotateRoll(Vector2(value, 0)); } 115 { this->rotateRoll(Vector2(value, 0)); } 112 116 113 void setOwner(Pawn* owner); 114 inline Pawn* getOwner() const 115 { return this->owner_; } 117 virtual void setShooter(Pawn* shooter); 116 118 117 119 inline bool hasFuel() const 118 { return this->fuel_; }120 { return this->fuel_; } 119 121 120 122 121 123 private: 122 WeakPtr<Pawn> owner_; 123 Vector3 localAngularVelocity_; 124 static const float FUEL_PERCENTAGE = 0.8f; //!< Percentage of lifetime the rocket has fuel 125 126 Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input. 124 127 bool fuel_; //!< Bool is true while the rocket "has fuel" 125 128 126 127 WeakPtr<PlayerInfo> player_; 128 Timer destroyTimer_; 129 float lifetime_; 130 static const int FUEL_PERCENTAGE=80; //!<Percentage of Lifetime the rocket has fuel 129 WeakPtr<PlayerInfo> player_; //!< The player the SimpleRocket belongs to. 130 Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out. 131 float lifetime_; //!< The time the projectile exists. 131 132 132 133 ParticleEmitter* fire_; //!< Fire-Emittor 133 134 135 136 134 }; 137 135
Note: See TracChangeset
for help on using the changeset viewer.