Changeset 5953 for code/branches/pickup2/src/orxonox/pickup/DroppedItem.h
- Timestamp:
- Oct 14, 2009, 4:36:56 PM (16 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
/code/branches/pickup2 (added) merged: 5942 /code/trunk (added) merged: 5900-5901,5923,5929,5936-5938,5940
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/orxonox/pickup/DroppedItem.h
r5947 r5953 37 37 #include "OrxonoxPrereqs.h" 38 38 39 #include "tools/Timer.h" 40 #include "tools/interfaces/Tickable.h" 41 #include "worldentities/StaticEntity.h" 39 #include "PickupSpawner.h" 42 40 43 41 namespace orxonox 44 42 { 45 class _OrxonoxExport DroppedItem : public StaticEntity, public Tickable43 class _OrxonoxExport DroppedItem : public PickupSpawner 46 44 { 47 public: 48 DroppedItem(BaseObject* creator); 49 virtual ~DroppedItem(); 45 public: 46 DroppedItem(BaseObject* creator); 47 DroppedItem(BaseObject* creator, BaseItem* item, float triggerDistance, float respawnTime, int maxSpawnedItems); 48 virtual ~DroppedItem(); 50 49 51 //TODO: Comment. 52 //DroppedItem -> Item with no owner, alone in space? 53 //Would be much nicer if it would be triggered by a standard issue DistanceTrigger. 54 //Where is this created? I see no XMLPort. 55 //Where is the item for this created? What happens if more than one pawn triggers this? 56 //Add more than just one items, or even better create the ability to add a Collection.? Rename to ...? 50 static DroppedItem* createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0); 51 static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0); 57 52 58 void tick(float dt);59 void trigger(Pawn* pawn);53 protected: 54 virtual BaseItem* getItem(void); 60 55 61 static DroppedItem* createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0); 62 static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0); 56 private: 63 57 64 void createTimer(); //TODO: Can this be made private, too? 65 void timerCallback(); //TODO: This should really be private. 58 BaseItem* item_; //!< The dropped item. 66 59 67 inline float getTriggerDistance() const68 { return this->triggerDistance_; }69 inline void setTriggerDistance(float distance)70 { this->triggerDistance_ = distance; }71 72 inline BaseItem* getItem() const73 { return this->item_; }74 //TODO: Needs to be public?75 inline void setItem(BaseItem* item)76 { this->item_ = item; }77 78 inline float getTimeToLive() const79 { return this->timeToLive_; }80 //TODO: Needs to be public?81 inline void setTimeToLive(float time)82 { this->timeToLive_ = time; }83 private:84 float timeToLive_;85 float triggerDistance_;86 BaseItem* item_;87 88 Timer timer_;89 60 }; 90 61 }
Note: See TracChangeset
for help on using the changeset viewer.