Changeset 5892 for code/branches/core5/src/modules
- Timestamp:
- Oct 6, 2009, 9:18:40 AM (15 years ago)
- Location:
- code/branches/core5/src/modules/pong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/modules/pong/PongBall.cc
r5889 r5892 33 33 #include "gametypes/Gametype.h" 34 34 #include "PongBat.h" 35 #include "sound/SoundBase.h"36 35 37 36 namespace orxonox … … 43 42 PongBall::PongBall(BaseObject* creator) 44 43 : MovableEntity(creator) 45 , sidesound_(NULL)46 , batsound_(NULL)47 , scoresound_(NULL)48 44 { 49 45 RegisterObject(PongBall); … … 57 53 58 54 this->registerVariables(); 59 60 if (GameMode::playsSound())61 {62 this->sidesound_ = new SoundBase(this);63 this->sidesound_->loadFile("sounds/pong_side.wav");64 65 this->batsound_ = new SoundBase(this);66 this->batsound_->loadFile("sounds/pong_bat.wav");67 68 this->scoresound_ = new SoundBase(this);69 this->scoresound_->loadFile("sounds/pong_score.wav");70 }71 55 } 72 56 73 57 PongBall::~PongBall() 74 58 { 75 if (this->sidesound_)76 delete this->sidesound_;77 if (this->batsound_)78 delete this->batsound_;79 if (this->scoresound_)80 delete this->scoresound_;81 59 } 82 60 … … 108 86 109 87 this->fireEvent(); 110 if (GameMode::playsSound())111 this->sidesound_->play();112 88 } 113 89 … … 128 104 129 105 this->fireEvent(); 130 if (GameMode::playsSound())131 this->batsound_->play();132 106 } 133 107 else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) … … 136 110 { 137 111 this->getGametype()->playerScored(this->bat_[0]->getPlayer()); 138 if (GameMode::playsSound())139 this->scoresound_->play();140 112 return; 141 113 } … … 152 124 153 125 this->fireEvent(); 154 if (GameMode::playsSound())155 this->batsound_->play();156 126 } 157 127 else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) … … 159 129 if (this->getGametype() && this->bat_[1]) 160 130 { 161 if (GameMode::playsSound())162 this->scoresound_->play();163 131 this->getGametype()->playerScored(this->bat_[1]->getPlayer()); 164 132 return; -
code/branches/core5/src/modules/pong/PongBall.h
r5881 r5892 76 76 unsigned int* batID_; 77 77 float relMercyOffset_; 78 79 SoundBase* sidesound_;80 SoundBase* batsound_;81 SoundBase* scoresound_;82 78 }; 83 79 }
Note: See TracChangeset
for help on using the changeset viewer.