Changeset 6207 for code/branches/presentation2/src/orxonox/items
- Timestamp:
- Dec 2, 2009, 5:40:13 PM (15 years ago)
- Location:
- code/branches/presentation2/src/orxonox/items
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc
r6205 r6207 45 45 namespace orxonox 46 46 { 47 static const float FORWARD_EFFECT_VELOCITY_THRESHOLD = 20;47 static const float FORWARD_EFFECT_VELOCITY_THRESHOLD = 0; 48 48 static const float MAX_VELOCITY_NORMAL = 111; 49 49 static const float MAX_VELOCITY_BOOST = 221; … … 56 56 57 57 defEngineSndNormal_ = new WorldSound(this); 58 defEngineSndBoost_ = new WorldSound(this); 58 59 defEngineSndNormal_->setLooping(true); 60 defEngineSndBoost_->setLooping(true); 59 61 60 62 this->lua_ = new LuaState(); … … 73 75 (*it2)->destroy(); 74 76 delete this->defEngineSndNormal_; 77 delete this->defEngineSndBoost_; 75 78 delete this->lua_; 76 79 } … … 82 85 XMLPortObject(MultiStateEngine, EffectContainer, "", addEffectContainer, getEffectContainer, xmlelement, mode); 83 86 XMLPortParam(MultiStateEngine, "defEngineSndNormal", setDefEngSndNormal, getDefEngSndNormal, xmlelement, mode); 87 XMLPortParam(MultiStateEngine, "defEngineSndBoost", setDefEngSndBoost, getDefEngSndBoost, xmlelement, mode); 84 88 } 85 89 … … 107 111 { 108 112 newState = Boost; 109 /*pitch = pitch/MAX_VELOCITY_BOOST + 1;113 pitch = pitch/MAX_VELOCITY_BOOST + 1; 110 114 pitch = pitch > 2 ? 2 : pitch; 111 115 pitch = pitch < 0.5 ? 0.5 : pitch; 112 defEngineSnd Normal_->setPitch(pitch);*/116 defEngineSndBoost_->setPitch(pitch); 113 117 } 114 118 else if (forward && !newState) // newState == Boost … … 155 159 lua_pushboolean(this->lua_->getInternalLuaState(), newState & Boost); 156 160 lua_setglobal(this->lua_->getInternalLuaState(), "boost"); 161 if(newState & Boost) 162 { 163 defEngineSndBoost_->play(); 164 } 165 else 166 { 167 defEngineSndBoost_->stop(); 168 } 157 169 } 158 170 … … 181 193 182 194 this->getShip()->attach(defEngineSndNormal_); 195 this->getShip()->attach(defEngineSndBoost_); 183 196 184 197 for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it) … … 220 233 return defEngineSndNormal_->getSource(); 221 234 } 235 236 void MultiStateEngine::setDefEngSndBoost(const std::string &engineSound) 237 { 238 defEngineSndBoost_->setSource(engineSound); 239 } 240 241 const std::string& MultiStateEngine::getDefEngSndBoost() 242 { 243 return defEngineSndBoost_->getSource(); 244 } 222 245 } -
code/branches/presentation2/src/orxonox/items/MultiStateEngine.h
r6202 r6207 64 64 void addEffectContainer(EffectContainer* effect); 65 65 EffectContainer* getEffectContainer(unsigned int index) const; 66 66 67 void setDefEngSndNormal(const std::string& engineSound); 67 68 const std::string& getDefEngSndNormal(); 69 void setDefEngSndBoost(const std::string& engineSound); 70 const std::string& getDefEngSndBoost(); 68 71 69 72 private: … … 72 75 std::vector<EffectContainer*> effectContainers_; 73 76 WorldSound* defEngineSndNormal_; 77 WorldSound* defEngineSndBoost_; 74 78 }; 75 79 }
Note: See TracChangeset
for help on using the changeset viewer.