- Timestamp:
- May 2, 2011, 2:18:04 PM (14 years ago)
- Location:
- code/branches/gameimmersion
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion
- Property svn:mergeinfo changed
/code/branches/steering merged: 8223
- Property svn:mergeinfo changed
-
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc
r8254 r8379 55 55 this->localAngularAcceleration_.setValue(0, 0, 0); 56 56 this->bBoost_ = false; 57 this->bPermanentBoost_ = false;58 57 this->steering_ = Vector3::ZERO; 59 58 this->engine_ = 0; … … 83 82 this->cameraOriginalOrientation = c->getOrientation(); 84 83 85 this->shakeFrequency_ = 20;84 this->shakeFrequency_ = 50; 86 85 this->shakeAmplitude_ = 40; 87 86 this->shakeDt_ = 0; … … 114 113 registerVariable(this->auxilaryThrust_, VariableDirection::ToClient); 115 114 registerVariable(this->rotationThrust_, VariableDirection::ToClient); 115 registerVariable(this->boostPower_, VariableDirection::ToClient); 116 registerVariable(this->boostPowerRate_, VariableDirection::ToClient); 117 registerVariable(this->boostRate_, VariableDirection::ToClient); 118 registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient); 116 119 } 117 120 … … 163 166 164 167 165 Camera* c = this->getCamera(); 168 166 169 if(this->bBoost_) 167 170 { … … 177 180 { 178 181 this->shakeDt_ += dt; 182 183 Camera* c = this->getCamera(); 179 184 180 185 //Shaking Camera effect … … 201 206 } 202 207 } 203 else204 {205 //reset the camera, if the boost is not active206 //TODO: don't call this every tick207 this->resetCamera();208 }209 208 } 210 209 } … … 254 253 } 255 254 256 // TODO: something seems to call this function every tick, could probably handled a little more efficiently! 257 void SpaceShip::setBoost(bool bBoost) 258 { 259 if(bBoost == this->bBoost_) 260 return; 261 262 if(bBoost) 263 this->boost(); 264 else 265 { 255 void SpaceShip::fire() 256 { 257 } 258 259 /** 260 @brief 261 Starts or stops boosting. 262 @param bBoost 263 Whether to start or stop boosting. 264 */ 265 void SpaceShip::boost(bool bBoost) 266 { 267 Camera* c = this->getCamera(); 268 269 if(bBoost && !this->bBoostCooldown_) 270 this->bBoost_ = true; 271 if(!bBoost) 272 { 266 273 this->bBoost_ = false; 267 } 268 } 269 270 void SpaceShip::fire() 271 { 272 } 273 274 void SpaceShip::boost() 275 { 276 if(!this->bBoostCooldown_) 277 this->bBoost_ = true; 274 this->resetCamera(); 275 } 278 276 } 279 277 … … 326 324 327 325 assert(c != 0); 326 327 if (c == 0) 328 { 329 COUT(2) << "Failed to reset camera!"; 330 return; 331 } 332 333 shakeDt_ = 0; 328 334 329 335 c->setAngularVelocity(Vector3(0,0,0)); -
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.h
r8254 r8379 59 59 60 60 virtual void fire(); 61 virtual void boost( );61 virtual void boost(bool bBoost); // Starts or stops boosting. 62 62 63 63 void setEngine(Engine* engine); … … 70 70 { return this->steering_; } 71 71 72 void setBoost(bool bBoost);73 72 inline bool getBoost() const 74 73 { return this->bBoost_; } … … 79 78 { return this->enginetemplate_; } 80 79 81 inline void setPermanentBoost(bool bPermanent)82 { this->bPermanentBoost_ = bPermanent; }83 inline bool getPermanentBoost() const84 { return this->bPermanentBoost_; }85 86 80 protected: 87 81 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const; … … 90 84 bool bBoost_; 91 85 bool bBoostCooldown_; 92 bool bPermanentBoost_;93 86 float boostPower_; 94 87 float initialBoostPower_;
Note: See TracChangeset
for help on using the changeset viewer.