Changeset 9155 for code/branches/pickup2012
- Timestamp:
- May 4, 2012, 3:56:56 PM (13 years ago)
- Location:
- code/branches/pickup2012
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2012/data/levels/includes/pickups.oxi
r8713 r9155 210 210 </PickupRepresentation> 211 211 212 <!-- DamageBoost Pickup --> 213 214 <PickupRepresentation 215 pickupName = "DamageBoost Pickup" 216 pickupDescription = "Multiplies the ship damage." 217 spawnerTemplate = "damageboostpickupRepresentation" 218 > 219 <pickup> 220 <DamageBoostPickup template=damageboostpickup /> 221 </pickup> 222 </PickupRepresentation> 223 212 224 <!-- Shrink Pickup --> 213 225 -
code/branches/pickup2012/data/levels/pickups.oxw
r9118 r9155 171 171 <!-- DamageBoost pickup --> 172 172 173 <PickupSpawner position="- 100,300,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">174 <pickup> 175 <DamageBoostPickup template= normaldamageboostpickup />173 <PickupSpawner position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 174 <pickup> 175 <DamageBoostPickup template=damageboostpickup /> 176 176 </pickup> 177 177 </PickupSpawner> -
code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt
r9118 r9155 218 218 <!-- DamageBoost pickups --> 219 219 220 <Template name= normaldamageboostpickupRepresentation>221 <PickupRepresentation> 222 <spawner-representation> 223 <StaticEntity> 224 <attached> 225 <Billboard position="0,0,0" colour="0. 99,0.96,0.52" material="Sphere2" scale=0.5>226 <attached> 227 <Billboard position="0,0,0" colour="0. 98,0.94,0.22" material="3arrowsup" scale=0.5/>228 </attached> 229 </Billboard> 230 </attached> 231 </StaticEntity> 232 </spawner-representation> 233 </PickupRepresentation> 234 </Template> 235 236 <Template name= normaldamageboostpickup>220 <Template name=damageboostpickupRepresentation> 221 <PickupRepresentation> 222 <spawner-representation> 223 <StaticEntity> 224 <attached> 225 <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 > 226 <attached> 227 <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damage" scale=0.7 /> 228 </attached> 229 </Billboard> 230 </attached> 231 </StaticEntity> 232 </spawner-representation> 233 </PickupRepresentation> 234 </Template> 235 236 <Template name=damageboostpickup> 237 237 <DamageBoostPickup 238 238 duration = 10.0 239 damageMultiplier = 20.0 239 240 activationType = "immediate" 240 241 durationType = "continuous" -
code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc
r9119 r9155 21 21 * 22 22 * Author: 23 * Eric Beier23 * Kevin Lengauer 24 24 * Co-authors: 25 25 * ... … … 28 28 29 29 /** 30 @file SpeedPickup.cc31 @brief Implementation of the SpeedPickup class.30 @file DamageBoostPickup.cc 31 @brief Implementation of the DamageBoostPickup class. 32 32 */ 33 33 … … 71 71 { 72 72 this->duration_ = 0.0f; 73 this->damageMultiplier_ = 20.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()); … … 105 105 106 106 XMLPortParam(DamageBoostPickup, "duration", setDuration, getDuration, xmlelement, mode); 107 XMLPortParam(DamageBoostPickup, "damageMultiplier", setD efaultDamageMultiplier, getDefaultDamageMultiplier, xmlelement, mode);107 XMLPortParam(DamageBoostPickup, "damageMultiplier", setDamageMultiplier, getDamageMultiplier, xmlelement, mode); 108 108 109 109 this->initializeIdentifier(); 110 110 } 111 112 // Work in Progress setDamage Function 113 void DamageBoostPickup::setDamageMultiplier(float damageMultiplier) 114 { 115 if(damageMultiplier >= 1.0f) 116 { 117 this->damageMultiplier_ = damageMultiplier; 118 orxout() << "Set Damage " << damageMultiplier << endl; 119 } 120 } 121 111 122 112 123 /** … … 138 149 } 139 150 } 140 // NOTE: commented this since its use was not apparent 141 // ship->getCreator(); 142 151 152 // Saves the old default Damage that is needed to restore the original damage 143 153 this->olddamageMultiplier_ = ship->getDamageMultiplier(); 154 // Sets the new Damage with the damage multiplier. 144 155 ship->setDamageMultiplier( this->damageMultiplier_ ); 145 156 } … … 214 225 else 215 226 { 216 orxout(internal_error, context::pickups) << "Invalid duration in SpeedPickup." << endl;227 orxout(internal_error, context::pickups) << "Invalid duration in DamagePickup." << endl; 217 228 this->duration_ = 0.0f; 218 229 } 219 230 } 220 231 221 /* void DamageBoostPickup::setDamageBoost(float damageBoost) 222 { 223 224 } 225 void DamageBoostPickup::setDamageSave(float damageSave) 226 { 227 228 } 229 */ 230 232 /** 233 @brief 234 Helper method. Is called by the Timer as soon as it expires. 235 */ 231 236 void DamageBoostPickup::pickupTimerCallback(void) 232 237 { -
code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h
r9119 r9155 21 21 * 22 22 * Author: 23 * Damian 'Mozork' Frick23 * Kevin Lengauer 24 24 * Co-authors: 25 25 * ... … … 53 53 54 54 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DamageBoostPickup object through XML. 55 // commented out cuz was not used56 // virtual void tick(float dt); //!< Is called every tick.57 55 58 56 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 59 57 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 60 61 /**62 @brief Get the damageboost that is transferred to the Pawn upon usage of this pickup.63 @return Returns the damageboost.64 */65 // Commentend, may not be used66 // inline float setDamageMultiplier(void) const67 // { ship->setMultiplier(); }68 69 58 70 59 /** … … 77 66 78 67 79 // we need these methods to set the default damage multiplier from XML 80 // not that beautiful yet 81 inline void setDefaultDamageMultiplier(float multiplier) 82 { this->damageMultiplier_ = multiplier; } 83 inline float getDefaultDamageMultiplier() 68 69 /** 70 @brief set Damage multiplier 71 @param multiplier The default damage multiplier to set 72 */ 73 inline float getDamageMultiplier() 84 74 { return this->damageMultiplier_; } 85 75 … … 89 79 protected: 90 80 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 81 void setDamageMultiplier(float damageMultiplier); 91 82 92 // void setDamageBoost(float damageBoost);//!< Sets the damage boost.93 // void setDamageSave(float damageSave); //!< Saves the original damage.94 83 95 84 private: 96 85 void initialize(void); //!< Initializes the member variables. 97 86 Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 98 SpaceShip* carrierToSpaceShipHelper(void); 87 SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 99 88 void pickupTimerCallback(void); 100 89 -
code/branches/pickup2012/src/modules/pickup/items/SpeedPickup.h
r8727 r9155 112 112 private: 113 113 void initialize(void); //!< Initializes the member variables. 114 SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceS Hip, and throw an error message if the conversion fails.114 SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 115 115 116 116 Timer durationTimer_; //!< Timer. -
code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc
r9118 r9155 234 234 Pawn *test = dynamic_cast<Pawn *>(originator); 235 235 if( test != NULL ) 236 { orxout() << "Test " << damage << endl; 236 237 damage *= originator->getDamageMultiplier(); 238 } 237 239 238 240 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
Note: See TracChangeset
for help on using the changeset viewer.