- Timestamp:
- Jun 9, 2010, 9:32:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/pickup/items/DronePickup.cc
r7034 r7127 49 49 50 50 CreateFactory(DronePickup); 51 51 52 52 /** 53 53 @brief … … 57 57 { 58 58 RegisterObject(DronePickup); 59 59 60 60 this->initialize(); 61 61 } 62 62 63 63 /** 64 64 @brief … … 67 67 DronePickup::~DronePickup() 68 68 { 69 69 70 70 } 71 71 72 72 /** 73 @brief 73 @brief 74 74 Initializes the member variables. 75 75 */ … … 80 80 this->droneTemplate_ = ""; 81 81 } 82 82 83 83 /** 84 84 @brief … … 91 91 this->pickupIdentifier_->addParameter(type, val); 92 92 } 93 93 94 94 /** 95 95 @brief … … 100 100 SUPER(DronePickup, XMLPort, xmlelement, mode); 101 101 XMLPortParam(DronePickup, "droneTemplate", setDroneTemplate, getDroneTemplate, xmlelement, mode); 102 102 103 103 this->initializeIdentifier(); 104 104 } 105 105 106 106 void DronePickup::setDroneTemplate(std::string templatename){ 107 107 droneTemplate_ = templatename; 108 } 109 108 } 109 110 110 const std::string& DronePickup::getDroneTemplate() const 111 111 { … … 120 120 { 121 121 SUPER(DronePickup, changedUsed); 122 122 123 123 //! If the pickup is not picked up nothing must be done. 124 124 if(!this->isPickedUp()) 125 125 return; 126 126 127 127 //! If the pickup has transited to used. 128 128 if(this->isUsed()) … … 132 132 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 133 133 this->destroy(); 134 134 135 135 //Attach to pawn 136 136 Drone* drone = new Drone(pawn->getCreator()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something) … … 143 143 droneController->setOwner(pawn); 144 144 } 145 145 146 146 Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30); 147 147 drone->setPosition(spawnPosition); 148 148 149 149 //! The pickup has been used up. 150 150 this->setUsed(false); … … 159 159 } 160 160 } 161 161 162 162 /** 163 163 @brief … … 170 170 PickupCarrier* carrier = this->getCarrier(); 171 171 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 172 172 173 173 if(pawn == NULL) 174 174 { 175 175 COUT(1) << "Invalid PickupCarrier in DronePickup." << std::endl; 176 176 } 177 177 178 178 return pawn; 179 179 } 180 180 181 181 /** 182 182 @brief … … 189 189 if(item == NULL) 190 190 item = new DronePickup(this); 191 191 192 192 SUPER(DronePickup, clone, item); 193 193 194 194 DronePickup* pickup = dynamic_cast<DronePickup*>(item); 195 195 pickup->setDroneTemplate(this->getDroneTemplate()); 196 196 197 197 pickup->initializeIdentifier(); 198 198 }
Note: See TracChangeset
for help on using the changeset viewer.