- Timestamp:
- Dec 25, 2009, 11:07:09 PM (15 years ago)
- Location:
- code/branches/pickup3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3
- Property svn:mergeinfo changed
/code/branches/pickup2 (added) merged: 5942,5947,5953,6405
- Property svn:mergeinfo changed
-
code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h
r6417 r6419 47 47 { 48 48 /** 49 50 49 @brief Class for a (temporary) modifier effect. 50 @author Daniel 'Huty' Haggenmueller 51 51 */ 52 //TODO: More elaborate comments. 52 53 class _OrxonoxExport ModifierPickup : public PassiveItem 53 54 { 54 public: 55 ModifierPickup(BaseObject* creator); 56 virtual ~ModifierPickup(); 55 //TODO: What does being derived from PassiveItem add exactly? Probably better to kill PassiveItem and just derive from BaseItem. 56 //Include ModifierType here, no additional header file needed for that, imo. 57 public: 58 ModifierPickup(BaseObject* creator); 59 virtual ~ModifierPickup(); 57 60 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);//!< To create a ModifierPickup through the level file.61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file. 59 62 60 virtual bool pickedUp(Pawn* pawn);//!< Override of the BaseItem::pickedUp() method.61 virtual bool dropped(Pawn* pawn);//!< Override of the BaseItem::dropped() method63 virtual bool pickedUp(Pawn* pawn); //!< Override of the BaseItem::pickedUp() method. 64 virtual bool dropped(Pawn* pawn); //!< Override of the BaseItem::dropped() method 62 65 63 virtual int getMaxCarryAmount(){ return INT_MAX; } //!< Allow the player to carry infinite ModPickups 66 //TODO: Where does this INT_MAX come from? Comment. 67 virtual int getMaxCarryAmount() //!< Allow the player to carry infinite ModPickups 68 { return INT_MAX; } 64 69 65 /**70 /** 66 71 @brief Get the duration of this pickup. 67 72 @return Returns how long the effect holds on. 68 */69 inline float getDuration() const70 { return this->duration_; }71 /**73 */ 74 inline float getDuration() const 75 { return this->duration_; } 76 /** 72 77 @brief Set the duration of this pickup. 73 78 @param duration How long the effect should hold. 74 */ 75 inline void setDuration(float duration) 76 { this->duration_ = duration; } 79 */ 80 //TODO: Better be private? 81 inline void setDuration(float duration) 82 { this->duration_ = duration; } 77 83 78 /** 84 //TODO: Shouldn't these all be seperate pickup items? But, then, would this class really be needed? What does it actually add? 85 //Duration! Thus create two virtual functions addEffect() and removeEffect(). 86 //Export the ideas here into seperate, individual subclasses. 87 //Shouldn't this, as an item be in the items folder? or is it, as merely the equivalent of an abstract class not specific enough? 88 //Specify what ModifierItem should do exactly. If the limited duration is the core functionality, another name would probably more fitting. 89 //Perhaps, limited effect duration could also just be another feature of BaseItem... 90 /** 79 91 @brief Get the amount of damage this pickup adds. 80 92 @return Returns how much damage this pickup adds. 81 */82 inline float getAdditiveDamage() const83 { return this->getAdditiveModifier(ModifierType::Damage); }84 /**93 */ 94 inline float getAdditiveDamage() const 95 { return this->getAdditiveModifier(ModifierType::Damage); } 96 /** 85 97 @brief Get the factor by which this pickup multiplies the damage. 86 98 @return Returns the factor by which to multiply damage. 87 */88 inline float getMultiplicativeDamage() const89 { return this->getMultiplicativeModifier(ModifierType::Damage); }99 */ 100 inline float getMultiplicativeDamage() const 101 { return this->getMultiplicativeModifier(ModifierType::Damage); } 90 102 91 /**103 /** 92 104 @brief Set the amount of damage this pickup adds. 93 105 @param value How much damage this pickup adds. 94 */95 inline void setAdditiveDamage(float value)96 { this->setAdditiveModifier(ModifierType::Damage, value); }97 /**106 */ 107 inline void setAdditiveDamage(float value) 108 { this->setAdditiveModifier(ModifierType::Damage, value); } 109 /** 98 110 @brief Set the factor by which this pickup multiplies the damage. 99 111 @param value Factor by which to multiply damage. 100 */101 inline void setMultiplicativeDamage(float value)102 { this->setMultiplicativeModifier(ModifierType::Damage, value); }112 */ 113 inline void setMultiplicativeDamage(float value) 114 { this->setMultiplicativeModifier(ModifierType::Damage, value); } 103 115 104 /**116 /** 105 117 @brief Get the amount of acceleration this pickup adds. 106 118 @return Returns how much acceleration this pickup adds. 107 */108 inline float getAdditiveAcceleration() const109 { return this->getAdditiveModifier(ModifierType::Acceleration); }110 /**119 */ 120 inline float getAdditiveAcceleration() const 121 { return this->getAdditiveModifier(ModifierType::Acceleration); } 122 /** 111 123 @brief Get the factor by which this pickup multiplies the acceleration. 112 124 @return Returns the factor by which to multiply acceleration. 113 */114 inline float getMultiplicativeAcceleration() const115 { return this->getMultiplicativeModifier(ModifierType::Acceleration); }125 */ 126 inline float getMultiplicativeAcceleration() const 127 { return this->getMultiplicativeModifier(ModifierType::Acceleration); } 116 128 117 /**129 /** 118 130 @brief Set the amount of acceleration this pickup adds. 119 131 @param value How much acceleration this pickup adds. 120 */121 inline void setAdditiveAcceleration(float value)122 { this->setAdditiveModifier(ModifierType::Acceleration, value); }123 /**132 */ 133 inline void setAdditiveAcceleration(float value) 134 { this->setAdditiveModifier(ModifierType::Acceleration, value); } 135 /** 124 136 @brief Set the factor by which this pickup multiplies the acceleration. 125 137 @param value Factor by which to multiply acceleration. 126 */127 inline void setMultiplicativeAcceleration(float value)128 { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }138 */ 139 inline void setMultiplicativeAcceleration(float value) 140 { this->setMultiplicativeModifier(ModifierType::Acceleration, value); } 129 141 130 void timerCallback(Pawn* pawn); //!< Method called when the timer runs out. 142 //TODO: Make private? 143 void timerCallback(Pawn* pawn); //!< Method called when the timer runs out. 131 144 132 private:133 float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType.134 float getMultiplicativeModifier(ModifierType::Value type) const; //!< Get the multiplicative modifier for a given ModifierType.135 void setAdditiveModifier(ModifierType::Value type, float value); //!< Set the additive modifier for a given ModifierType.136 void setMultiplicativeModifier(ModifierType::Value type, float value); //!< Set the multiplicative modifier for a given ModifierType145 private: 146 float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType. 147 float getMultiplicativeModifier(ModifierType::Value type) const; //!< Get the multiplicative modifier for a given ModifierType. 148 void setAdditiveModifier(ModifierType::Value type, float value); //!< Set the additive modifier for a given ModifierType. 149 void setMultiplicativeModifier(ModifierType::Value type, float value); //!< Set the multiplicative modifier for a given ModifierType 137 150 138 std::map<ModifierType::Value, float> additiveModifiers_; //!< Map of additive modifiers, indexed by ModifierType.139 std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType.151 std::map<ModifierType::Value, float> additiveModifiers_; //!< Map of additive modifiers, indexed by ModifierType. 152 std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType. 140 153 141 float duration_; //!< Duration of this pickup's effect (0 for unlimited).142 Timer timer_; //!< Timer used if the pickup's effect has a time limit.154 float duration_; //!< Duration of this pickup's effect (0 for unlimited). 155 Timer timer_; //!< Timer used if the pickup's effect has a time limit. 143 156 }; 144 157 }
Note: See TracChangeset
for help on using the changeset viewer.