Changeset 7547 for code/trunk/src/modules/pickup/items/InvisiblePickup.cc
- Timestamp:
- Oct 16, 2010, 12:37:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pickup/items/InvisiblePickup.cc
r7546 r7547 35 35 36 36 #include <sstream> 37 #include <OgreEntity.h> 38 #include <OgreAnimationState.h> 39 40 #include "util/StringUtils.h" 37 //#include <OgreEntity.h> 38 //#include <OgreAnimationState.h> 41 39 #include "core/CoreIncludes.h" 42 40 #include "core/XMLPort.h" 43 41 42 #include "pickup/PickupIdentifier.h" 44 43 #include "worldentities/pawns/Pawn.h" 45 #include "pickup/PickupIdentifier.h"46 44 47 45 namespace orxonox … … 68 66 } 69 67 70 68 /** 69 @brief 70 Initializes the member variables. 71 */ 72 void InvisiblePickup::initialize(void) 73 { 74 this->duration_ = 0.0f; 75 // Defines who is allowed to pick up the pickup. 76 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 77 } 78 79 /** 80 @brief 81 Initializes the PickupIdentifier of this pickup. 82 */ 71 83 void InvisiblePickup::initializeIdentifier(void) 72 84 { … … 80 92 /** 81 93 @brief 82 Initializes the member variables.83 */84 void InvisiblePickup::initialize(void)85 {86 this->duration_ = 0.0f;87 // Defines who is allowed to pick up the pickup.88 this->addTarget(ClassIdentifier<Pawn>::getIdentifier());89 }90 91 /**92 @brief93 94 Method for creating a HealthPickup object through XML. 94 95 */ … … 113 114 return; 114 115 116 // If the pickup has transited to used. 115 117 if (this->isUsed()) 116 118 { 119 // If its durationType is continuous, we set a Timer to be reminded, when the time has run out. 117 120 if(this->isContinuous()) 118 121 { … … 134 137 this->setInvisible(false); 135 138 139 // We destroy the pickup if either, the pickup has activationType immediate and durationType once or it has durationType continuous and the duration was exceeded. 136 140 if((!this->isContinuous() && this->isImmediate()) || (this->isContinuous() && !this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration())) 137 141 { 138 142 this->Pickupable::destroy(); 139 143 } 144 // We pause the Timer if the pickup is continuous and the duration is not yet exceeded, 140 145 else if(this->isContinuous() && this->durationTimer_.isActive()) 141 146 { … … 143 148 } 144 149 } 145 146 }147 148 /**149 @brief150 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.151 @return152 A pointer to the Pawn, or NULL if the conversion failed.153 */154 Pawn* InvisiblePickup::carrierToPawnHelper(void)155 {156 PickupCarrier* carrier = this->getCarrier();157 Pawn* pawn = dynamic_cast<Pawn*>(carrier);158 159 if(pawn == NULL)160 {161 COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl;162 }163 return pawn;164 150 } 165 151 … … 212 198 /** 213 199 @brief 200 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 201 @return 202 A pointer to the Pawn, or NULL if the conversion failed. 203 */ 204 Pawn* InvisiblePickup::carrierToPawnHelper(void) 205 { 206 PickupCarrier* carrier = this->getCarrier(); 207 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 208 209 if(pawn == NULL) 210 { 211 COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl; 212 } 213 return pawn; 214 } 215 216 /** 217 @brief 214 218 Sets the time the InvisibilityPickup will last. 215 219 @param duration
Note: See TracChangeset
for help on using the changeset viewer.