Changeset 9889 for code/branches/sfxThilo/src/modules
- Timestamp:
- Dec 9, 2013, 4:06:38 PM (11 years ago)
- Location:
- code/branches/sfxThilo/src/modules/pong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sfxThilo/src/modules/pong/PongBall.cc
r9720 r9889 41 41 #include "PongBat.h" 42 42 43 #include "sound/WorldSound.h" //Thilo43 #include "sound/WorldSound.h" 44 44 #include "core/XMLPort.h" 45 45 … … 70 70 this->registerVariables(); 71 71 72 // Thilo72 //initialize sound 73 73 if (GameMode::isMaster()) 74 74 { 75 75 this->defScoreSound_ = new WorldSound(this->getContext()); 76 this->defScoreSound_->set Looping(false);76 this->defScoreSound_->setVolume(1.0f); 77 77 this->defBatSound_ = new WorldSound(this->getContext()); 78 this->defBatSound_->set Looping(false);78 this->defBatSound_->setVolume(0.4f); 79 79 this->defBoundarySound_ = new WorldSound(this->getContext()); 80 this->defBoundarySound_->set Looping(false);80 this->defBoundarySound_->setVolume(0.5f); 81 81 } 82 82 else 83 83 { 84 84 this->defScoreSound_ = 0; 85 this->defBatSound_ = 0; 86 this->defBoundarySound_ = 0; 85 87 } 86 88 } … … 101 103 } 102 104 103 // Thilo105 //xml port for loading sounds 104 106 void PongBall::XMLPort(Element& xmlelement, XMLPort::Mode mode) 105 107 { … … 144 146 if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2) 145 147 { 146 // Its velocity in z-direction is inverted (i.e. it bounces off). 148 defBoundarySound_->play(); //play boundary sound 149 // Its velocity in z-direction is inverted (i.e. it bounces off). 147 150 velocity.z = -velocity.z; 148 151 // And its position is set as to not overstep the boundary it has just crossed. … … 169 172 if (fabs(distance) <= 1) // If the bat is there to parry. 170 173 { 171 // Set the ball to be exactly at the boundary. 174 defBatSound_->play(); //play bat sound 175 // Set the ball to be exactly at the boundary. 172 176 position.x = this->fieldWidth_ / 2; 173 177 // Invert its velocity in x-direction (i.e. it bounces off). … … 182 186 else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) 183 187 { 184 defScoreSound_->play();// Thilo188 defScoreSound_->play();//play score sound 185 189 if (this->getGametype() && this->bat_[0]) 186 190 { … … 197 201 if (fabs(distance) <= 1) // If the bat is there to parry. 198 202 { 199 // Set the ball to be exactly at the boundary. 203 defBatSound_->play(); //play bat sound 204 // Set the ball to be exactly at the boundary. 200 205 position.x = -this->fieldWidth_ / 2; 201 206 // Invert its velocity in x-direction (i.e. it bounces off). … … 210 215 else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) 211 216 { 212 defScoreSound_->play();// Thilo217 defScoreSound_->play();//play score sound 213 218 if (this->getGametype() && this->bat_[1]) 214 219 { -
code/branches/sfxThilo/src/modules/pong/PongBall.h
r9720 r9889 126 126 static const float MAX_REL_Z_VELOCITY; 127 127 128 void setDefScoreSound(const std::string& engineSound); //Thilo 129 const std::string& getDefScoreSound(); //Thilo 128 void setDefScoreSound(const std::string& engineSound); 129 const std::string& getDefScoreSound(); 130 void setDefBatSound(const std::string& engineSound); 131 const std::string& getDefBatSound(); 132 void setDefBoundarySound(const std::string& engineSound); 133 const std::string& getDefBoundarySound(); 130 134 131 135 private: … … 141 145 unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network. 142 146 float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have. 143 WorldSound* defScoreSound_;//Thilo 147 WorldSound* defScoreSound_; 148 WorldSound* defBatSound_; 149 WorldSound* defBoundarySound_; 144 150 }; 145 151 }
Note: See TracChangeset
for help on using the changeset viewer.