Changeset 7067
- Timestamp:
- May 31, 2010, 6:41:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ppspickups4/src/modules/pickup/items/InvisiblePickup.cc
r6755 r7067 43 43 #include <sstream> 44 44 45 #include <OgreEntity.h> 46 #include <Ogre.h> 47 45 48 namespace orxonox 46 49 { 47 50 48 51 CreateFactory(InvisiblePickup); 49 52 50 53 /** 51 54 @brief … … 56 59 RegisterObject(InvisiblePickup); 57 60 //! Defines who is allowed to pick up the pickup. 58 this->initialize(); 59 } 60 61 this->initialize(); 62 } 63 61 64 /** 62 65 @brief … … 64 67 */ 65 68 InvisiblePickup::~InvisiblePickup() 66 { 67 } 68 69 69 { 70 } 71 72 70 73 void InvisiblePickup::initializeIdentifier(void) 71 74 { … … 76 79 this->pickupIdentifier_->addParameter(type1, val1); 77 80 } 78 81 79 82 /** 80 83 @brief … … 93 96 void InvisiblePickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) 94 97 { 95 SUPER(InvisiblePickup, XMLPort, xmlelement, mode); 98 SUPER(InvisiblePickup, XMLPort, xmlelement, mode); 96 99 XMLPortParam(InvisiblePickup, "duration", setDuration, getDuration, xmlelement, mode); 97 100 98 101 this->initializeIdentifier(); 99 102 } 100 103 101 104 /** 102 105 @brief … … 106 109 { 107 110 SUPER(InvisiblePickup, changedUsed); 108 111 109 112 //! If the pickup is not picked up nothing must be done. 110 113 if(!this->isPickedUp()) 111 114 return; 112 115 113 116 if (this->isUsed()) 114 117 { … … 121 124 this->startPickupTimer(this->getDuration()); 122 125 } 126 123 127 this->setInvisible(true); 128 124 129 } 125 130 else 126 131 { 127 132 this->setInvisible(false); 128 133 129 134 if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration()) 130 135 { … … 136 141 } 137 142 } 138 139 } 140 143 144 } 145 141 146 /** 142 147 @brief … … 149 154 PickupCarrier* carrier = this->getCarrier(); 150 155 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 151 156 152 157 if(pawn == NULL) 153 158 { … … 156 161 return pawn; 157 162 } 158 163 159 164 /** 160 165 @brief … … 167 172 if(item == NULL) 168 173 item = new InvisiblePickup(this); 169 174 170 175 SUPER(InvisiblePickup, clone, item); 171 176 172 177 InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item); 173 178 pickup->setDuration(this->getDuration()); 174 179 pickup->initializeIdentifier(); 175 180 } 176 181 177 182 /** 178 183 @brief … … 186 191 if(pawn == NULL) 187 192 return false; 188 193 189 194 pawn->setVisible(!invisibility); 195 pawn->setRadarVisibility(!invisibility); 196 197 // Test to change Material at runtime! 198 199 // Ogre::MaterialPtr mat = this->mesh_.getEntity()->getSubEntity(0)->getMaterial(); 200 // mat->setDiffuse(0.4, 0.3, 0.1, 0.1); 201 // mat->setAmbient(0.3, 0.7, 0.8); 202 // mat->setSpecular(0.5, 0.5, 0.5, 0.1); 203 // Ogre::SceneBlendType sbt = Ogre::SBT_ADD; 204 // 205 // mat->setSceneBlending(sbt); 206 190 207 return true; 191 208 } 192 209 193 210 /** 194 211 @brief … … 209 226 } 210 227 } 211 228 212 229 void InvisiblePickup::pickupTimerCallback(void) 213 230 {
Note: See TracChangeset
for help on using the changeset viewer.