- Timestamp:
- May 8, 2014, 4:14:31 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc
r10041 r10050 59 59 60 60 this->figure_ = 0; 61 this->bDeleteBats_ = false;62 this->batID_ = new unsigned int[1];63 this->batID_[0] = OBJECTID_UNKNOWN;64 this->relMercyOffset_ = 0.05f;65 66 this->registerVariables();67 61 68 62 //initialize sound … … 86 80 this->setVelocity(Vector3(0,0,0)); 87 81 this->setAcceleration(Vector3(0,0,0)); 88 89 model = NULL;90 82 } 91 83 … … 116 108 /** 117 109 @brief 118 Register variables to synchronize over the network.119 */120 void JumpPlatform::registerVariables()121 {122 registerVariable( this->fieldWidth_ );123 registerVariable( this->fieldHeight_ );124 registerVariable( this->relMercyOffset_ );125 registerVariable( this->batID_[0] );126 //registerVariable( this->batID_[1], VariableDirection::ToClient, new NetworkCallback<JumpPlatform>( this, &JumpPlatform::applyBats) );127 }128 129 /**130 @brief131 110 Is called every tick. 132 111 Handles the movement of the ball and its interaction with the boundaries and bats. … … 147 126 if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-10 && figurePosition.x < platformPosition.x+10 && figurePosition.z > platformPosition.z-4 && figurePosition.z < platformPosition.z+4) 148 127 { 149 figure_->JumpFromPlatform(200.0f);128 touchFigure(); 150 129 } 151 130 } … … 249 228 void JumpPlatform::setFigure(WeakPtr<JumpFigure> newFigure) 250 229 { 251 if (this->bDeleteBats_) // If there are already some bats, delete them. 252 { 253 delete this->figure_; 254 this->bDeleteBats_ = false; 255 } 256 257 this->figure_ = newFigure; 258 // Also store their object IDs, for synchronization. 259 this->batID_[0] = this->figure_->getObjectID(); 260 } 261 262 /** 263 @brief 264 Get the bats over the network. 265 */ 266 void JumpPlatform::applyBats() 267 { 268 // Make space for the bats, if they don't exist, yet. 269 if (this->figure_ == NULL) 270 { 271 this->figure_ = *(new WeakPtr<JumpFigure>); 272 this->bDeleteBats_ = true; 273 } 274 275 if (this->batID_[0] != OBJECTID_UNKNOWN) 276 { 277 // WAR IM PONG NICHT AUSKOMMENTIERT!!! 278 //this->figure_ = orxonox_cast<JumpFigure>(Synchronisable::getSynchronisable(this->batID_[0])); 279 } 230 figure_ = newFigure; 231 } 232 233 void JumpPlatform::accelerateFigure() 234 { 235 figure_->JumpFromPlatform(this); 236 } 237 238 void JumpPlatform::touchFigure() 239 { 240 280 241 } 281 242
Note: See TracChangeset
for help on using the changeset viewer.