- Timestamp:
- Mar 4, 2010, 11:56:26 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
r6421 r6466 39 39 #include "core/XMLPort.h" 40 40 #include "worldentities/pawns/Pawn.h" 41 #include "PickupManager.h" 42 #include "PickupRepresentation.h" 41 43 //#include "PickupInventory.h" // HACK; Only for hack, remove later 42 44 … … 59 61 PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator) 60 62 { 63 RegisterObject(PickupSpawner); 64 61 65 this->initialize(); 66 67 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(NULL); 68 69 COUT(1) << "MUP4 " << representation << std::endl; 70 this->attach(representation->getSpawnerRepresentation(this)); 71 72 COUT(1) << "MUP6" << std::endl; 62 73 } 63 74 … … 78 89 PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator) 79 90 { 91 RegisterObject(PickupSpawner); 92 80 93 this->initialize(); 81 94 … … 85 98 this->respawnTime_ = respawnTime; 86 99 this->setMaxSpawnedItems(maxSpawnedItems); 100 101 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier()); 102 this->attach(representation->getSpawnerRepresentation(this)); 87 103 } 88 104 … … 93 109 void PickupSpawner::initialize(void) 94 110 { 95 RegisterObject(PickupSpawner);96 97 111 this->pickup_ = NULL; 98 112 … … 215 229 Time since last tick. 216 230 */ 217 //TODO: Replace this with a real DistanceTrigger? 231 //TODO: Replace this with a real DistanceTrigger? Or better with collisions? 218 232 void PickupSpawner::tick(float dt) 219 233 { … … 259 273 if (pickup != NULL) //!< If everything went ok, and pickup is not NULL. 260 274 { 275 //TODO: Not correct anymore. 261 276 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn); 262 277 if(carrier == NULL) … … 266 281 } 267 282 268 if( pickup->pickup(carrier))283 if(carrier->pickup(pickup)) 269 284 { 270 285 COUT(3) << "Pickup got picked up." << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.