- Timestamp:
- Dec 10, 2008, 5:25:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups2/src/orxonox/objects/pickup/PickupSpawner.cc
r2227 r2389 16 16 17 17 this->template_ = 0; 18 this->distance_ = 50; 18 this->distance_ = 20; 19 this->respawntimer_= 0; 19 20 } 20 21 … … 28 29 29 30 XMLPortParam(PickupSpawner, "item", setItemTemplate, getItemTemplate, xmlelement, mode); 30 XMLPortParam(PickupSpawner, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(50.0f); 31 XMLPortParam(PickupSpawner, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(20.0f); 32 XMLPortParam(PickupSpawner, "respawntimer", setRespawnTimer, getRespawnTimer, xmlelement, mode); 33 31 34 } 32 35 … … 54 57 if (this->isActive() && this->template_ && this->template_->getBaseclassIdentifier()) 55 58 { 56 COUT(0) << " activated" << std::endl;59 COUT(0) << "ITEM PICKED UP" << std::endl; 57 60 //if(player->isA(itemtemplate_->getPlayerBaseClass())) 58 61 { … … 63 66 newitem->addTemplate(this->itemtemplate_); 64 67 if (newitem->pickedUp(player)== true) 68 { 69 if(respawntimer_!=0) 70 this->triggerRespawnTimer(); 65 71 this->setActive(false); 72 this->fireEvent(); 73 } 66 74 else 67 75 delete newobject; … … 72 80 } 73 81 } 82 83 void PickupSpawner::triggerRespawnTimer() 84 { 85 86 if(respawntimer_!=0) 87 { 88 ExecutorMember<BaseObject>* executor = createExecutor(createFunctor(&BaseObject::setActive)); 89 executor->setDefaultValues(true); 90 RespawnTimer_.setTimer(this->respawntimer_, false, (BaseObject*)this, executor); 91 COUT(0) << "TIMER SET" << std::endl; 92 } 74 93 } 94 void PickupSpawner::changedActivity() 95 { 96 /* 97 COUT(0) << "Visble?" << std::endl; 98 if(isActive()) 99 { 100 setVisible(true); 101 COUT(0) << "Visble!" << std::endl; 102 } 103 if(isActive()==false) 104 { 105 setVisible(false); 106 COUT(0) << "INvisble!" << std::endl; 107 } 108 109 */ 110 SUPER(PickupSpawner, changedActivity); 111 112 for (std::set<WorldEntity*>::iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); ++it) 113 (*it)->setVisible(this->isActive()); 114 } 115 116 117 } 118 119 120
Note: See TracChangeset
for help on using the changeset viewer.