Changeset 7090 for code/branches/presentation3
- Timestamp:
- Jun 2, 2010, 9:44:22 PM (14 years ago)
- Location:
- code/branches/presentation3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3
- Property svn:mergeinfo changed
/code/branches/ppspickups4 (added) merged: 7067-7068
- Property svn:mergeinfo changed
-
code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.cc
r6755 r7090 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 { -
code/branches/presentation3/src/orxonox/controllers/AIController.cc
r7066 r7090 33 33 #include "core/Executor.h" 34 34 #include "worldentities/ControllableEntity.h" 35 #include "worldentities/pawns/Pawn.h" 35 36 36 37 namespace orxonox … … 210 211 { 211 212 if (this->target_) 212 this->aimAtTarget(); 213 { 214 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 215 this->forgetTarget(); 216 else this->aimAtTarget(); 217 } 213 218 214 219 if (this->bHasTargetPosition_) … … 239 244 { 240 245 if (this->target_) 241 this->aimAtTarget(); 246 { 247 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 248 this->forgetTarget(); 249 else this->aimAtTarget(); 250 } 242 251 243 252 if (this->bHasTargetPosition_) -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
r7066 r7090 760 760 continue; 761 761 762 /* So AI won't choose invisible Spaceships as target */ 763 if (!it->getRadarVisibility()) 764 continue; 765 762 766 if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity()) 763 767 {
Note: See TracChangeset
for help on using the changeset viewer.