Changeset 9184 for code/branches/pickup2012/src
- Timestamp:
- May 18, 2012, 12:47:54 PM (13 years ago)
- Location:
- code/branches/pickup2012/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc
r9155 r9184 70 70 void DamageBoostPickup::initialize(void) 71 71 { 72 73 72 this->duration_ = 0.0f; 73 this->damageMultiplier_ = 1.0f; //The default damage multiplier. 74 74 //Defines who is allowed to pick up the pickup. 75 75 this->addTarget(ClassIdentifier<SpaceShip>::getIdentifier()); … … 89 89 90 90 stream.clear(); 91 stream << this-> damageMultiplier_;91 stream << this->getDamageMultiplier(); 92 92 std::string type2 = "damageMultiplier"; 93 93 std::string val2 = stream.str(); … … 116 116 { 117 117 this->damageMultiplier_ = damageMultiplier; 118 orxout() << "Set Damage " << damageMultiplier << endl; 119 } 120 } 121 122 123 /** 124 @brief 125 Is called when the pickup has transited from used to unused or the other way around. 118 } 119 } 120 121 122 /** 123 @brief 124 Is called when the pickup has transisted from used to unused or the other way around. 126 125 */ 127 126 void DamageBoostPickup::changedUsed(void) … … 151 150 152 151 // Saves the old default Damage that is needed to restore the original damage 153 this->olddamageMultiplier_ = ship->getDamageMultiplier();154 // Sets the new Damage with the damage multiplier .155 ship->setDamageMultiplier( this->damageMultiplier_);152 this->olddamageMultiplier_ = 1.0f; 153 // Sets the new Damage with the damage multiplier 154 ship->setDamageMultiplier(this->getDamageMultiplier()); 156 155 } 157 156 else … … 206 205 DamageBoostPickup* pickup = dynamic_cast<DamageBoostPickup*>(item); 207 206 pickup->setDuration(this->getDuration()); 208 209 207 pickup->setDamageMultiplier(this->getDamageMultiplier()); 210 208 pickup->initializeIdentifier(); 211 209 } -
code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h
r9155 r9184 63 63 inline float getDuration(void) const 64 64 { return this->duration_; } 65 65 66 inline void setDuration( float duration ); 66 67 … … 79 80 protected: 80 81 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 81 void setDamageMultiplier(float damageMultiplier); 82 void setDamageMultiplier(float damageMultiplier); //!< Sets the DamageMultiplier according to the XML. 82 83 83 84 -
code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc
r9155 r9184 231 231 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 232 232 { 233 // apply multiplier233 //Applies multiplier given by the DamageBoost Pickup. 234 234 Pawn *test = dynamic_cast<Pawn *>(originator); 235 235 if( test != NULL ) 236 { orxout() << "Test " << damage << endl;236 { 237 237 damage *= originator->getDamageMultiplier(); 238 238 } -
code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h
r9099 r9184 162 162 { return this->numexplosionchunks_; } 163 163 164 // not that beautiful yet164 // These are used with the Damage Boost Pickup to use the damage multiplier. 165 165 inline void setDamageMultiplier(float multiplier) 166 166 { this->damageMultiplier_ = multiplier; } … … 215 215 float reloadWaitCountdown_; 216 216 217 // modifiers218 float damageMultiplier_; 217 // Modifier 218 float damageMultiplier_; // Used by the Damage Boost Pickup. 219 219 220 220 WeakPtr<Pawn> lastHitOriginator_;
Note: See TracChangeset
for help on using the changeset viewer.