- Timestamp:
- Jun 9, 2010, 9:32:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/pickup/PickupSpawner.cc
r7086 r7127 55 55 { 56 56 RegisterObject(PickupSpawner); 57 57 58 58 this->initialize(); 59 59 } … … 76 76 { 77 77 RegisterObject(PickupSpawner); 78 78 79 79 this->initialize(); 80 80 81 81 this->pickup_ = pickup; 82 82 … … 84 84 this->respawnTime_ = respawnTime; 85 85 this->setMaxSpawnedItems(maxSpawnedItems); 86 86 87 87 if(this->pickup_ == NULL) 88 88 { … … 132 132 133 133 XMLPortObject(PickupSpawner, Pickupable, "pickup", setPickupable, getPickupable, xmlelement, mode); 134 134 135 135 XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode); 136 136 XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode); 137 137 XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode); 138 138 139 139 if(this->pickup_ == NULL) 140 140 { … … 150 150 } 151 151 } 152 152 153 153 /** 154 154 @brief … … 161 161 this->setVisible(this->isActive()); 162 162 } 163 163 164 164 /** 165 165 @brief … … 172 172 { 173 173 SUPER(PickupSpawner, tick, dt); 174 174 175 175 //! If the PickupSpawner is active. 176 176 if (this->isActive()) 177 177 { 178 178 SmartPtr<PickupSpawner> temp = this; // create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup) 179 179 180 180 //! Iterate trough all Pawns. 181 181 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) … … 191 191 } 192 192 } 193 193 194 194 /** 195 195 @brief … … 203 203 this->spawnsRemaining_ = items; 204 204 } 205 205 206 206 /** 207 207 @brief … … 230 230 } 231 231 } 232 232 233 233 /** 234 234 @brief … … 239 239 this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this))); 240 240 } 241 241 242 242 /** 243 243 @brief … … 258 258 return; 259 259 } 260 260 261 261 this->pickup_ = pickup; 262 262 } 263 263 264 264 /** 265 265 @brief … … 285 285 { 286 286 COUT(4) << "PickupSpawner (&" << this << ") triggered and active." << std::endl; 287 287 288 288 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn); 289 289 if(carrier == NULL) … … 292 292 return; 293 293 } 294 294 295 295 if(!carrier->isTarget(this->pickup_)) 296 296 { … … 298 298 return; 299 299 } 300 300 301 301 PickupCarrier* target = carrier->getTarget(this->pickup_); 302 302 Pickupable* pickup = this->getPickup(); 303 303 304 304 if(target != NULL && pickup != NULL) 305 305 { … … 317 317 if(target == NULL) 318 318 COUT(1) << "PickupSpawner (&" << this << "): Pickupable has no target." << std::endl; 319 319 320 320 if(pickup == NULL) 321 321 { … … 335 335 @return 336 336 The Pickupable created. 337 */ 337 */ 338 338 Pickupable* PickupSpawner::getPickup(void) 339 339 { … … 343 343 return NULL; 344 344 } 345 345 346 346 Pickupable* pickup = this->pickup_->clone(); 347 347 return pickup;
Note: See TracChangeset
for help on using the changeset viewer.