- Timestamp:
- Dec 21, 2009, 1:18:36 PM (15 years ago)
- Location:
- code/branches/presentation2/src/modules/weapons/projectiles
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/weapons/projectiles/LightningGunProjectile.cc
r5929 r6387 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 56 this->materialBase_ = material; 57 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/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
r6383 r6387 58 58 this->bDestroy_ = false; 59 59 this->lifetime_ = 100; 60 60 61 61 if (GameMode::isMaster()) 62 62 { 63 63 this->setCollisionType(WorldEntity::Kinematic); 64 64 this->setVelocity(0,0,-100); 65 65 66 66 Model* model = new Model(this); 67 67 model->setMeshSource("rocket.mesh"); … … 72 72 fire->setOrientation(this->getOrientation()); 73 73 fire->setSource("Orxonox/rocketfire"); 74 74 75 75 this->enableCollisionCallback(); 76 76 this->setCollisionResponse(false); … … 83 83 84 84 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this))); 85 85 86 86 this->defSndWpnEngine_ = new WorldSound(this); 87 87 this->defSndWpnEngine_->setLooping(true); … … 99 99 this->defSndWpnLaunch_ = 0; 100 100 } 101 101 102 102 CameraPosition* camPosition = new CameraPosition(this); 103 103 camPosition->setPosition(0,4,15); … … 134 134 SUPER(Rocket, XMLPort, xmlelement, mode); 135 135 } 136 136 137 137 void Rocket::setOwner(Pawn* owner) 138 138 { … … 158 158 { 159 159 SUPER(Rocket, tick, dt); 160 160 161 161 if( this->hasLocalController() ) 162 162 { … … 164 164 this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() ); 165 165 this->localAngularVelocity_ = 0; 166 166 167 167 if( this->bDestroy_ ) 168 168 this->destroy(); 169 169 } 170 170 } 171 171 172 172 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 173 173 { … … 176 176 if (otherObject == this->owner_) 177 177 return false; 178 178 179 179 this->bDestroy_ = true; 180 180 … … 211 211 return false; 212 212 } 213 213 214 214 void Rocket::destroyObject() 215 215 { … … 223 223 } 224 224 } 225 225 226 226 void Rocket::fired(unsigned int firemode) 227 227 { … … 258 258 { 259 259 ControllableEntity::rotateYaw(value); 260 260 261 261 if( !this->isInMouseLook() ) 262 262 this->localAngularVelocity_.y += value.x; … … 272 272 { 273 273 ControllableEntity::rotatePitch(value); 274 274 275 275 if( !this->isInMouseLook() ) 276 276 this->localAngularVelocity_.x += value.x; … … 286 286 { 287 287 ControllableEntity::rotateRoll(value); 288 288 289 289 if( !this->isInMouseLook() ) 290 290 this->localAngularVelocity_.z += value.x; 291 291 } 292 292 293 293 } -
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h
r6378 r6387 54 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML. 55 55 virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick. 56 56 57 57 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 58 58 void destroyObject(); 59 59 60 60 virtual void moveFrontBack(const Vector2& value){} 61 61 virtual void moveRightLeft(const Vector2& value){} … … 65 65 virtual void rotatePitch(const Vector2& value); 66 66 virtual void rotateRoll(const Vector2& value); 67 67 68 68 /** 69 69 @brief Moves the Rocket in the Front/Back-direction by the specifed amount. … … 84 84 inline void moveUpDown(float value) 85 85 { this->moveUpDown(Vector2(value, 0)); } 86 86 87 87 /** 88 88 @brief Rotates the Rocket around the y-axis by the specifed amount. … … 103 103 inline void rotateRoll(float value) 104 104 { this->rotateRoll(Vector2(value, 0)); } 105 105 106 106 void setOwner(Pawn* owner); 107 107 inline Pawn* getOwner() const 108 108 { return this->owner_; } 109 109 110 110 inline void setDamage(float damage) 111 111 { this->damage_ = damage; } … … 113 113 { return this->damage_; } 114 114 virtual void fired(unsigned int firemode); 115 115 116 116 private: 117 117 WeakPtr<Pawn> owner_; … … 120 120 bool bDestroy_; 121 121 ControllableEntity* originalControllableEntity_; 122 122 123 123 WeakPtr<PlayerInfo> player_; 124 124 Timer destroyTimer_;
Note: See TracChangeset
for help on using the changeset viewer.