Changeset 7751 for code/branches/presentation/src
- Timestamp:
- Dec 9, 2010, 12:45:33 PM (14 years ago)
- Location:
- code/branches/presentation/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/overlays/hud/HUDBar.cc
r7401 r7751 85 85 this->bar_->setMaterialName(materialname); 86 86 87 this->value_ = 1.0f; // initi elize with 1.0f to trigger a change when calling setValue(0.0f) on the line below87 this->value_ = 1.0f; // initialize with 1.0f to trigger a change when calling setValue(0.0f) on the line below 88 88 this->setAutoColour(true); 89 89 this->setValue(0.0f); // <-- … … 161 161 if (this->right2Left_) 162 162 { 163 // backward case w163 // backward case 164 164 this->bar_->setPosition(0.06f + 0.88f * (1 - this->value_), 0.0f); 165 165 this->bar_->setDimensions(0.88f * this->value_, 1.0f); -
code/branches/presentation/src/orxonox/LevelManager.cc
r7724 r7751 152 152 Ogre::StringVectorPtr levels = Resource::findResourceNames("*.oxw"); 153 153 // Iterate over all *.oxw level files. 154 COUT(3) << "Loading LevelInfos..." << std::endl; 154 155 for (Ogre::StringVector::const_iterator it = levels->begin(); it != levels->end(); ++it) 155 156 { -
code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.cc
r7547 r7751 57 57 this->engine_ = 0; 58 58 59 this->boostPower_ = 10.0f; 60 this->initialBoostPower_ = 10.0f; 61 this->boostRate_ = 5.0; 62 this->boostPowerRate_ = 1.0; 63 this->boostCooldownDuration_ = 5.0; 64 this->bBoostCooldown_ = false; 59 65 60 66 this->bInvertYAxis_ = false; … … 86 92 XMLPortParamVariable(SpaceShip, "auxilaryThrust", auxilaryThrust_, xmlelement, mode); 87 93 XMLPortParamVariable(SpaceShip, "rotationThrust", rotationThrust_, xmlelement, mode); 94 XMLPortParamVariable(SpaceShip, "boostPower", initialBoostPower_, xmlelement, mode); 95 XMLPortParamVariable(SpaceShip, "boostPowerRate", boostPowerRate_, xmlelement, mode); 96 XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode); 97 XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode); 88 98 } 89 99 … … 134 144 this->localAngularAcceleration_.setValue(0, 0, 0); 135 145 } 136 } 146 147 if(!this->bBoostCooldown_ && this->boostPower_ < this->initialBoostPower_) 148 { 149 this->boostPower_ += this->boostPowerRate_*dt; 150 } 151 if(this->bBoost_) 152 { 153 this->boostPower_ -=this->boostRate_*dt; 154 if(this->boostPower_ <= 0.0f) 155 { 156 this->bBoost_ = false; 157 this->bBoostCooldown_ = true; 158 this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this))); 159 } 160 } 161 } 162 } 163 164 void SpaceShip::boostCooledDown(void) 165 { 166 this->bBoostCooldown_ = false; 137 167 } 138 168 … … 175 205 Pawn::rotateRoll(value); 176 206 } 207 208 // TODO: something seems to call this function every tick, could probably handled a little more efficiently! 209 void SpaceShip::setBoost(bool bBoost) 210 { 211 if(bBoost == this->bBoost_) 212 return; 213 214 if(bBoost) 215 this->boost(); 216 else 217 { 218 this->bBoost_ = false; 219 } 220 } 177 221 178 222 void SpaceShip::fire() … … 182 226 void SpaceShip::boost() 183 227 { 184 this->bBoost_ = true; 228 if(!this->bBoostCooldown_) 229 this->bBoost_ = true; 185 230 } 186 231 -
code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.h
r7547 r7751 34 34 #include <string> 35 35 #include <LinearMath/btVector3.h> 36 #include "tools/Timer.h" 36 37 #include "util/Math.h" 37 38 #include "Pawn.h" … … 69 70 { return this->steering_; } 70 71 71 inline void setBoost(bool bBoost) 72 { this->bBoost_ = bBoost; } 72 void setBoost(bool bBoost); 73 73 inline bool getBoost() const 74 74 { return this->bBoost_; } … … 89 89 90 90 bool bBoost_; 91 bool bBoostCooldown_; 91 92 bool bPermanentBoost_; 93 float boostPower_; 94 float initialBoostPower_; 95 float boostRate_; 96 float boostPowerRate_; 97 float boostCooldownDuration_; 92 98 Vector3 steering_; 93 99 float primaryThrust_; … … 102 108 103 109 void loadEngineTemplate(); 110 111 void boostCooledDown(void); 104 112 105 113 std::string enginetemplate_; 106 114 Engine* engine_; 115 Timer timer_; 107 116 }; 108 117 }
Note: See TracChangeset
for help on using the changeset viewer.