Changeset 10688 in orxonox.OLD for branches/adm/src
- Timestamp:
- Jun 13, 2007, 1:21:07 PM (18 years ago)
- Location:
- branches/adm/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/adm/src/world_entities/npcs/adm_turret.cc
r10683 r10688 24 24 #include "loading/load_param_xml.h" 25 25 26 #include "environments/bsp_entity.h" 27 26 28 ObjectListDefinition(AdmTurret); 27 29 CREATE_FACTORY(AdmTurret); 28 29 30 30 31 /** … … 136 137 this->range = 400; 137 138 this->isCeil = false; 139 this->bFire = false; 140 this->playerVisible = false; 138 141 } 139 142 … … 141 144 { 142 145 WorldEntity::tick(dt); 146 147 this->updatePlayerVisible(); 143 148 144 149 //rotate sensor 2PI/sec … … 252 257 this->sensor->toList( getOMListNumber() ); 253 258 } 259 254 260 255 261 void AdmTurret::moveTowards( Vector targetDir, float dt ) … … 322 328 this->cannons->setAbsDir( bestBodyRot * bestCannonRot ); 323 329 } 330 331 void AdmTurret::updatePlayerVisible( ) 332 { 333 std::list<WorldEntity*>::iterator entityIterator; 334 // for all bsp managers check all entities 335 Vector pos = this->cannons->getAbsCoor(); 336 Vector dir = this->myTarget->getAbsCoor() - pos; 337 338 this->playerVisible = true; 339 for( ObjectList<BspEntity>::const_iterator bspIterator = BspEntity::objectList().begin(); 340 bspIterator != BspEntity::objectList().end(); 341 bspIterator++) { 342 float res = (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollisionRay( pos, dir, dir.len() + 1 ); 343 344 if ( res < dir.len() ) 345 this->playerVisible = false; 346 } 347 } -
branches/adm/src/world_entities/npcs/adm_turret.h
r10681 r10688 11 11 12 12 #include "world_entity.h" 13 #include "weapons/light_blaster.h" 13 14 14 15 class AdmTurret : public WorldEntity … … 53 54 bool isCeil; 54 55 void setType( const std::string& type ); 55 56 57 bool bFire; 58 bool playerVisible; 59 void updatePlayerVisible(); 56 60 }; 57 61
Note: See TracChangeset
for help on using the changeset viewer.