Changeset 6512 for code/branches/pickup3/src
- Timestamp:
- Mar 11, 2010, 4:30:30 PM (15 years ago)
- Location:
- code/branches/pickup3/src
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/DroppedPickup.cc
r6475 r6512 40 40 namespace orxonox 41 41 { 42 43 CreateFactory(DroppedPickup); 44 42 45 /** 43 46 @brief … … 63 66 The distance at which the PickupSpawner triggers. Default is 10. 64 67 */ 65 DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 0, 1)68 DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 10, 1) 66 69 { 67 70 RegisterObject(DroppedPickup); … … 70 73 71 74 this->setPosition(position); 75 this->setActive(false); 76 this->startRespawnTimer(); 72 77 } 73 78 -
code/branches/pickup3/src/modules/pickup/PickupPrereqs.h
r6496 r6512 76 76 //items 77 77 class HealthPickup; 78 class TestPickup; 78 79 79 80 } -
code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc
r6484 r6512 154 154 { 155 155 StaticEntity* representation = new StaticEntity(spawner); 156 //TODO: Nicer... 157 Billboard* billboard = new Billboard(spawner); 158 billboard->setColour(ColourValue(1.0, 0.0, 0.0)); 159 billboard->setMaterial("Examples/Flare"); 160 representation->attach(billboard); 156 Billboard* sphere = new Billboard(spawner); 157 sphere->setColour(ColourValue(0.95, 0.85, 0.27)); 158 sphere->setMaterial("Sphere2"); 159 sphere->setScale(0.1); 160 Billboard* icon = new Billboard(spawner); 161 icon->setColour(ColourValue(0.89, 0.79, 0.08)); 162 icon->setMaterial("Asterix"); 163 icon->setScale(0.5); 164 sphere->attach(icon); 165 representation->attach(sphere); 161 166 return representation; 162 167 } -
code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
r6499 r6512 216 216 { 217 217 //TODO: Nicer? Does this even work? 218 this-> respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));218 this->startRespawnTimer(); 219 219 220 220 this->setActive(false); … … 227 227 this->destroy(); 228 228 } 229 } 230 231 /** 232 @brief 233 Starts the respawn timer. 234 */ 235 void PickupSpawner::startRespawnTimer(void) 236 { 237 this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this))); 229 238 } 230 239 -
code/branches/pickup3/src/modules/pickup/PickupSpawner.h
r6496 r6512 101 101 protected: 102 102 void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns. 103 104 void startRespawnTimer(void); 103 105 104 106 virtual Pickupable* getPickup(void); //!< Creates a new Pickupable. -
code/branches/pickup3/src/modules/pickup/items/CMakeLists.txt
r6474 r6512 1 1 ADD_SOURCE_FILES(PICKUP_SRC_FILES 2 2 HealthPickup.cc 3 TestPickup.cc 3 4 ) -
code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h
r6477 r6512 40 40 #include <set> 41 41 #include "Pickupable.h" 42 #include "core/Identifier.h" 42 43 43 44 #include "core/OrxonoxClass.h" … … 45 46 namespace orxonox 46 47 { 48 49 class Pickup; 50 class HealthPickup; 51 class TestPickup; 47 52 48 53 /** … … 55 60 { 56 61 friend class Pickupable; //!< The Pickupable has full acces to its PickupCarrier. 62 //TODO: Ugly workaround. 63 friend class Pickup; 64 friend class HealthPickup; 65 friend class TestPickup; 57 66 58 67 public: … … 69 78 bool pickedUp = this->pickups_.insert(pickup).second; 70 79 if(pickedUp) 80 { 81 COUT(4) << "Picked up Pickupable " << pickup->getIdentifier()->getName() << "(&" << pickup << ")." << std::endl; 71 82 pickup->pickedUp(this); 83 } 72 84 return pickedUp; 73 85 } … … 81 93 bool drop(Pickupable* pickup, bool drop = true) 82 94 { 83 bool dropped = this->pickups_.erase(pickup) == 1; 84 if(dropped && drop) 85 { 86 pickup->dropped(); 87 } 88 return dropped; 95 bool dropped = this->pickups_.erase(pickup) == 1; 96 if(dropped && drop) 97 { 98 COUT(4) << "Dropping Pickupable " << pickup->getIdentifier()->getName() << "(&" << pickup << ")." << std::endl; 99 pickup->dropped(); 100 } 101 return dropped; 89 102 } 90 103 … … 161 174 */ 162 175 virtual const Vector3& getCarrierPosition(void) = 0; 176 177 //TODO: Remove. 178 std::set<Pickupable*>& getPickups(void) 179 { return this->pickups_; } 163 180 164 181 private: -
code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc
r6497 r6512 198 198 //TODO: possible problem. 199 199 if(!created) 200 { 200 201 this->destroy(); 202 } 201 203 202 204 return true;
Note: See TracChangeset
for help on using the changeset viewer.