Changeset 5902 for code/branches/pickup/src/orxonox/pickup/PickupSpawner.h
- Timestamp:
- Oct 7, 2009, 2:20:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup/src/orxonox/pickup/PickupSpawner.h
r5781 r5902 50 50 class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable 51 51 { 52 public: 53 PickupSpawner(BaseObject* creator); 54 virtual ~PickupSpawner(); 52 public: 53 //TODO: Add limit of items spawned here. Also possibility to spawn collections? 54 PickupSpawner(BaseObject* creator); 55 virtual ~PickupSpawner(); 55 56 56 virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty).57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML.58 virtual void tick(float dt);57 virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty). 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML. 59 virtual void tick(float dt); 59 60 60 void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough.61 void respawnTimerCallback(); //!< Method called when the timer runs out.61 void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough. 62 void respawnTimerCallback(); //!< Method called when the timer runs out. 62 63 63 /**64 /** 64 65 @brief Get the template name for the item to spawn. 65 66 @return Returns the name of the template of the item to spawn. 66 */67 inline const std::string& getItemTemplateName() const68 { return this->itemTemplateName_; }69 void setItemTemplateName(const std::string& name); //!< Set the template name of the item to spawn.67 */ 68 inline const std::string& getItemTemplateName() const 69 { return this->itemTemplateName_; } 70 void setItemTemplateName(const std::string& name); //!< Set the template name of the item to spawn. 70 71 71 /**72 @brief Get the template for the item to spawn.73 @return Returns the template of the item to spawn.74 */75 inline Template* getItemTemplate() const76 { return this->itemTemplate_; }72 /** 73 @brief Get the template for the item to spawn. 74 @return Returns the template of the item to spawn. 75 */ 76 inline Template* getItemTemplate() const 77 { return this->itemTemplate_; } 77 78 78 /**79 @brief Get the distance in which to trigger.80 @return Returns the distance in which this gets triggered.81 */82 inline float getTriggerDistance() const83 { return this->triggerDistance_; }84 /**85 @brief Set the distance in which to trigger.86 @param value The new distance in which to trigger.87 */88 inline void setTriggerDistance(float value)89 { this->triggerDistance_ = value; }79 /** 80 @brief Get the distance in which to trigger. 81 @return Returns the distance in which this gets triggered. 82 */ 83 inline float getTriggerDistance() const 84 { return this->triggerDistance_; } 85 /** 86 @brief Set the distance in which to trigger. 87 @param value The new distance in which to trigger. 88 */ 89 inline void setTriggerDistance(float value) 90 { this->triggerDistance_ = value; } 90 91 91 /**92 @brief Get the time to respawn.93 @returns Returns the time after which this gets re-actived.94 */95 inline float getRespawnTime() const96 { return this->respawnTime_; }97 /**98 @brief Set the time to respawn.99 @param time New time after which this gets re-actived.100 */101 inline void setRespawnTime(float time)102 { this->respawnTime_ = time; }103 private:104 std::string itemTemplateName_; //!< Template name of the item to spawn.105 Template* itemTemplate_; //!< Template of the item to spawn.92 /** 93 @brief Get the time to respawn. 94 @returns Returns the time after which this gets re-actived. 95 */ 96 inline float getRespawnTime() const 97 { return this->respawnTime_; } 98 /** 99 @brief Set the time to respawn. 100 @param time New time after which this gets re-actived. 101 */ 102 inline void setRespawnTime(float time) 103 { this->respawnTime_ = time; } 104 private: 105 std::string itemTemplateName_; //!< Template name of the item to spawn. 106 Template* itemTemplate_; //!< Template of the item to spawn. 106 107 107 float triggerDistance_; //!< Distance in which this gets triggered.108 float triggerDistance_; //!< Distance in which this gets triggered. 108 109 109 /* Pickup animation */110 float tickSum_; //!< Adds up tick to use in sine movement111 static const float bounceSpeed_s; //!< Speed of pickup to bounce up and down112 static const float bounceDistance_s; //!< Distance the pickup bounces up and down113 static const float rotationSpeed_s; //!< Rotation speed of pickup110 /* Pickup animation */ 111 float tickSum_; //!< Adds up tick to use in sine movement 112 static const float bounceSpeed_s; //!< Speed of pickup to bounce up and down 113 static const float bounceDistance_s; //!< Distance the pickup bounces up and down 114 static const float rotationSpeed_s; //!< Rotation speed of pickup 114 115 115 float respawnTime_; //!< Time after which this gets re-actived.116 Timer<PickupSpawner> respawnTimer_; //!< Timer used for re-activating.116 float respawnTime_; //!< Time after which this gets re-actived. 117 Timer<PickupSpawner> respawnTimer_; //!< Timer used for re-activating. 117 118 }; 118 119 }
Note: See TracChangeset
for help on using the changeset viewer.