Changeset 3196 for code/trunk/src/orxonox/objects/worldentities/PongBall.cc
- Timestamp:
- Jun 20, 2009, 9:20:47 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pch (added) merged: 3114-3118,3124-3125,3127-3131,3133,3138-3194
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/PongBall.cc
r3110 r3196 32 32 #include "core/GameMode.h" 33 33 #include "objects/gametypes/Gametype.h" 34 #include "objects/worldentities/PongBat.h" 34 35 #include "sound/SoundBase.h" 35 36 … … 49 50 this->batID_[0] = OBJECTID_UNKNOWN; 50 51 this->batID_[1] = OBJECTID_UNKNOWN; 51 this->relMercyOffset_ = 0.05 ;52 this->relMercyOffset_ = 0.05f; 52 53 53 54 this->registerVariables(); … … 102 103 if (position.x > this->fieldWidth_ / 2 && this->bat_[1]) 103 104 { 104 distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10 ) / 2);105 distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2); 105 106 if (fabs(distance) <= 1) 106 107 { … … 122 123 if (position.x < -this->fieldWidth_ / 2 && this->bat_[0]) 123 124 { 124 distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10 ) / 2);125 distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2); 125 126 if (fabs(distance) <= 1) 126 127 { … … 172 173 if (position.x > this->fieldWidth_ / 2 && this->bat_[1]) 173 174 { 174 distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10 ) / 2);175 distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2); 175 176 if (fabs(distance) <= 1) 176 177 { … … 183 184 if (position.x < -this->fieldWidth_ / 2 && this->bat_[0]) 184 185 { 185 distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10 ) / 2);186 distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2); 186 187 if (fabs(distance) <= 1) 187 188 { … … 217 218 } 218 219 } 220 221 void PongBall::setBats(PongBat** bats) 222 { 223 this->bat_ = bats; 224 this->batID_[0] = this->bat_[0]->getObjectID(); 225 this->batID_[1] = this->bat_[1]->getObjectID(); 226 } 227 228 void PongBall::applyBats() 229 { 230 if (!this->bat_) 231 this->bat_ = new PongBat*[2]; 232 if (this->batID_[0] != OBJECTID_UNKNOWN) 233 this->bat_[0] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0])); 234 if (this->batID_[1] != OBJECTID_UNKNOWN) 235 this->bat_[1] = dynamic_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1])); 236 } 219 237 }
Note: See TracChangeset
for help on using the changeset viewer.