Changeset 10632 for code/trunk
- Timestamp:
- Oct 10, 2015, 7:55:21 PM (9 years ago)
- Location:
- code/trunk/src/modules/jump
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/jump/JumpPlatform.cc
r10624 r10632 54 54 figure_ = 0; 55 55 56 //initialize sound57 if (GameMode::isMaster())58 {59 defScoreSound_ = new WorldSound(this->getContext());60 defScoreSound_->setVolume(1.0f);61 defBatSound_ = new WorldSound(this->getContext());62 defBatSound_->setVolume(0.4f);63 defBoundarySound_ = new WorldSound(this->getContext());64 defBoundarySound_->setVolume(0.5f);65 }66 else67 {68 defScoreSound_ = 0;69 defBatSound_ = 0;70 defBoundarySound_ = 0;71 }72 73 56 setPosition(Vector3(0,0,0)); 74 57 setVelocity(Vector3(0,0,0)); … … 85 68 } 86 69 87 //xml port for loading sounds70 //xml port for loading height and width of the platform 88 71 void JumpPlatform::XMLPort(Element& xmlelement, XMLPort::Mode mode) 89 72 { … … 92 75 XMLPortParam(JumpPlatform, "height", setHeight, getHeight, xmlelement, mode); 93 76 XMLPortParam(JumpPlatform, "width", setWidth, getWidth, xmlelement, mode); 94 95 XMLPortParam(JumpPlatform, "defScoreSound", setDefScoreSound, getDefScoreSound, xmlelement, mode);96 XMLPortParam(JumpPlatform, "defBatSound", setDefBatSound, getDefBatSound, xmlelement, mode);97 XMLPortParam(JumpPlatform, "defBoundarySound", setDefBoundarySound, getDefBoundarySound, xmlelement, mode);98 77 } 99 78 … … 134 113 135 114 } 136 137 void JumpPlatform::setDefScoreSound(const std::string &jumpSound)138 {139 if( defScoreSound_ )140 defScoreSound_->setSource(jumpSound);141 else142 assert(0); // This should never happen, because soundpointer is only available on master143 }144 145 const std::string& JumpPlatform::getDefScoreSound()146 {147 if( defScoreSound_ )148 return defScoreSound_->getSource();149 else150 assert(0);151 return BLANKSTRING;152 }153 154 void JumpPlatform::setDefBatSound(const std::string &jumpSound)155 {156 if( defBatSound_ )157 defBatSound_->setSource(jumpSound);158 else159 assert(0); // This should never happen, because soundpointer is only available on master160 }161 162 const std::string& JumpPlatform::getDefBatSound()163 {164 if( defBatSound_ )165 return defBatSound_->getSource();166 else167 assert(0);168 return BLANKSTRING;169 }170 171 void JumpPlatform::setDefBoundarySound(const std::string &jumpSound)172 {173 if( defBoundarySound_ )174 defBoundarySound_->setSource(jumpSound);175 else176 assert(0); // This should never happen, because soundpointer is only available on master177 }178 179 const std::string& JumpPlatform::getDefBoundarySound()180 {181 if( defBoundarySound_ )182 return defBoundarySound_->getSource();183 else184 assert(0);185 return BLANKSTRING;186 }187 115 } -
code/trunk/src/modules/jump/JumpPlatform.h
r10624 r10632 52 52 virtual void touchFigure(); 53 53 54 void setDefScoreSound(const std::string& engineSound);55 const std::string& getDefScoreSound();56 void setDefBatSound(const std::string& engineSound);57 const std::string& getDefBatSound();58 void setDefBoundarySound(const std::string& engineSound);59 const std::string& getDefBoundarySound();60 61 54 void setWidth(const float width) 62 55 { this->width_ = width; } … … 72 65 float height_; 73 66 WeakPtr<JumpFigure> figure_; 74 WorldSound* defScoreSound_;75 WorldSound* defBatSound_;76 WorldSound* defBoundarySound_;77 67 }; 78 68 }
Note: See TracChangeset
for help on using the changeset viewer.