- Timestamp:
- Sep 4, 2011, 3:15:41 PM (13 years ago)
- Location:
- code/branches/ai2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/data/levels/missionOne.oxw
r8873 r8874 401 401 402 402 403 <!--404 <events>405 <visibility>406 <EventTrigger>407 <events>408 <trigger>409 <EventListener event=trigger1 />410 </trigger>411 </events>412 <EventTrigger invert=true>413 <events>414 <trigger>415 <EventListener event=trigger2 />416 </trigger>417 </events>418 </EventTrigger>419 </EventTrigger>420 </visibility>421 </events>422 Activated: after destroying pirates after successfull docking// Deactivated: @Beginning, after first usage, after second usage423 424 activate:425 426 <EventListener event="movingpirates2" />427 428 <EventListener event=ondock />429 430 deactivate:431 432 433 <EventListener event=toHydroFarmer />434 435 436 <EventListener event=attack />437 438 -->439 440 403 <!-- @Objects: PORTAL: from DuBall to HydroHarvester --> 441 404 <Template name=PortalDefault> … … 462 425 <events> 463 426 <trigger> 464 <EventListener event= toHydroFarmer/>427 <EventListener event="toHydroFarmer" /> 465 428 </trigger> 466 429 </events> … … 471 434 <events> 472 435 <trigger> 473 <EventListener event= ondock/>436 <EventListener event="ondock" /> 474 437 </trigger> 475 438 </events> … … 478 441 <events> 479 442 <trigger> 480 <EventListener event= attack/>443 <EventListener event="attack" /> 481 444 </trigger> 482 445 </events> 483 446 </EventTrigger> 484 447 </Trigger> 448 <EventTrigger> 449 <events> 450 <trigger> 451 <EventListener event="HydroFarmer" /> 452 </trigger> 453 </events> 454 </EventTrigger> 485 455 </Trigger> 486 456 </activity> … … 491 461 <events> 492 462 <activity> 493 <Trigger mode="or" activations=" 2">463 <Trigger mode="or" activations="3"> 494 464 <Trigger mode="and" activations="1"> 495 465 <EventTrigger> … … 503 473 <events> 504 474 <trigger> 505 <EventListener event= toHydroFarmer/>475 <EventListener event="toHydroFarmer" /> 506 476 </trigger> 507 477 </events> … … 512 482 <events> 513 483 <trigger> 514 <EventListener event= ondock/>484 <EventListener event="ondock" /> 515 485 </trigger> 516 486 </events> … … 519 489 <events> 520 490 <trigger> 521 <EventListener event= attack/>491 <EventListener event="attack" /> 522 492 </trigger> 523 493 </events> 524 494 </EventTrigger> 525 495 </Trigger> 496 <EventTrigger> 497 <events> 498 <trigger> 499 <EventListener event="HydroFarmer" /> 500 </trigger> 501 </events> 502 </EventTrigger> 526 503 </Trigger> 527 504 </activity> … … 530 507 <PortalLink fromID="1" toID="2" /> 531 508 <PortalLink fromID="2" toID="1" /> 509 <!-- ????????????????????????????????????????????????????? why does this NOT work ?? 510 <Trigger mode="and" activations="1"> 511 <EventTrigger> 512 <events> 513 <trigger> 514 <EventListener event="HydroFarmer" /> 515 </trigger> 516 </events> 517 </EventTrigger> 518 <EventTrigger invert=true> 519 <events> 520 <trigger> 521 <EventListener event="attack" /> 522 </trigger> 523 </events> 524 </EventTrigger> 525 </Trigger> 526 --> 532 527 <!-- PORTALS END--> 533 528 534 <!--DistanceTrigger name="toHydroFarmer" position="-47000,-1000,1300" target="Pawn" distance=700 stayActive="true" delay=0 /--> 535 <SimpleNotification message=" Findthe Hydrogen Farmer.">529 530 <SimpleNotification message="Dock to the Hydrogen Farmer."> 536 531 <events> 537 532 <trigger> … … 562 557 563 558 <!-- @Objects: HYDROGEN FARMER & DOCKING --> 564 <SpaceShip position="-48900,100,0" roll=90 yaw=0 pitch=20 mass=10000 health=100000 >559 <SpaceShip position="-48900,100,0" roll=90 yaw=0 pitch=20 mass=10000 health=100000 name="HydroFarmer"> 565 560 <attached> 566 561 <!-- Docking --> … … 626 621 </Dock> 627 622 628 <SpaceShip template="spaceshipspacecruiser" position="-48900,800,0" orientation="-0.14, 0.68, 0.68, 0.223" health="300" maxhealth="400" initialhealth="300" >623 <SpaceShip template="spaceshipspacecruiser" position="-48900,800,0" orientation="-0.14, 0.68, 0.68, 0.223" health="300" maxhealth="400" initialhealth="300" name="cruiser" > 629 624 <attached> 630 625 <DockingTarget name="spaceShip" /> 631 626 </attached> 632 627 </SpaceShip> 628 629 630 <Trigger name="cruiserFriendlyFire" mode="and" activations="2"> 631 <EventTrigger> 632 <events> 633 <trigger> 634 <EventListener event="cruiser" /> 635 </trigger> 636 </events> 637 </EventTrigger> 638 <EventTrigger invert=true> 639 <events> 640 <trigger> 641 <EventListener event="ondock" /> 642 </trigger> 643 </events> 644 </EventTrigger> 645 </Trigger> 646 647 648 <SimpleNotification message="You killed the Hydrogen Farmer!" broadcast="true"> 649 <events> 650 <trigger> 651 <EventListener event="HydroFarmer" /> 652 </trigger> 653 </events> 654 </SimpleNotification> 655 656 <SimpleNotification message="You killed the SpaceCruiser!" broadcast="true"> 657 <events> 658 <trigger> 659 <EventListener event="cruiserFriendlyFire" /><!--cruiserFriendlyFire--> 660 </trigger> 661 </events> 662 </SimpleNotification> 663 664 665 633 666 <!-- hydrogen farmer & docking END --> 634 667 … … 1126 1159 - Foolproof text messages (e.g. verspätete Nachrichten unterdrücken) 1127 1160 - Radar visibility & Hud Markers 1161 - End Tutorial, if either the Hydrogen Farmer or the SpaceCruiser gets destroyed. 1162 1128 1163 --> -
code/branches/ai2/src/modules/overlays/hud/HUDNavigation.cc
r8706 r8874 63 63 { 64 64 SetConfigValue(markerLimit_, 3); 65 65 66 } 66 67 … … 77 78 setTextSize ( 0.05f ); 78 79 setNavMarkerSize ( 0.05f ); 80 setDetectionLimit( 10000.0f ); 79 81 } 80 82 … … 95 97 SUPER ( HUDNavigation, XMLPort, xmlelement, mode ); 96 98 97 XMLPortParam ( HUDNavigation, "font", setFont, getFont, xmlelement, mode ); 98 XMLPortParam ( HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode ); 99 XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode ); 99 XMLPortParam ( HUDNavigation, "font", setFont, getFont, xmlelement, mode ); 100 XMLPortParam ( HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode ); 101 XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode ); 102 XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode ); 100 103 } 101 104 … … 161 164 162 165 unsigned int markerCount_ = 0; 163 166 bool closeEnough_ = false; //inly display objects that are close enough to be relevant for the player 164 167 // for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it) 165 168 for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt ) 166 169 { 167 170 ObjectMap::iterator it = activeObjectList_.find ( listIt->first ); 168 169 if ( markerCount_ < markerLimit_ ) 171 if( detectionLimit_ < 0 ) 172 closeEnough_ = true ; 173 else 174 closeEnough_ = listIt->second < detectionLimit_ ; 175 if ( markerCount_ < markerLimit_ && closeEnough_ ) // display on HUD íf statement is true 170 176 { 171 177 … … 277 283 it->second.text_->show(); 278 284 } 279 else 285 else // do not display on HUD 280 286 { 281 287 it->second.panel_->hide(); … … 309 315 void HUDNavigation::addObject ( RadarViewable* object ) 310 316 { 311 if( showObject(object) ==false )317 if( showObject(object) == false ) 312 318 return; 313 319 … … 396 402 return false; 397 403 assert( rv->getWorldEntity() ); 398 if ( rv->getWorldEntity()->isVisible() ==false || rv->getRadarVisibility()==false )404 if ( rv->getWorldEntity()->isVisible() == false || rv->getRadarVisibility() == false ) 399 405 return false; 400 406 return true; -
code/branches/ai2/src/modules/overlays/hud/HUDNavigation.h
r7401 r8874 85 85 { return navMarkerSize_; } 86 86 87 void setDetectionLimit( float limit ) 88 { this->detectionLimit_ = limit; } 89 float getDetectionLimit() const 90 { return this->detectionLimit_; } 91 87 92 void setTextSize ( float size ); 88 93 float getTextSize() const; … … 102 107 float textSize_; 103 108 104 unsigned int markerLimit_; ;//TODO: is it possible to set this over the console and/or the IG-Setting105 106 109 unsigned int markerLimit_; //TODO: is it possible to set this over the console and/or the IG-Setting 110 float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. 111 //!< In order to bypass this behaviour, set a negative detectionLimit_. Then the detection range is "infinite". 107 112 }; 108 113 } -
code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc
r7880 r8874 64 64 this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png"; 65 65 this->shapeMaterials_[RadarViewable::Square] = "RadarSquare.png"; 66 66 this->setDetectionLimit( 10000.0f ); 67 67 this->owner_ = 0; 68 68 } … … 94 94 if (object == dynamic_cast<RadarViewable*>(this->owner_)) 95 95 return; 96 if( showObject(object) == false ) //do not show objects that are "invisible" or "radar invisible" 97 return; 96 98 97 99 // Make sure the object hasn't been added yet … … 123 125 void HUDRadar::objectChanged( RadarViewable* rv ) 124 126 { 125 if (rv == dynamic_cast<RadarViewable*>(this->owner_)) 126 return; 127 if(rv == dynamic_cast<RadarViewable*>(this->owner_)) //case: player changed 128 return; 129 if( showObject(rv) == false ) //case: (radar) invisible object changed 130 return; 131 if( this->radarObjects_.find(rv) == this->radarObjects_.end() ) // if (radar) invisibility becomes (radar) visible 132 this->addObject(rv); 127 133 assert( this->radarObjects_.find(rv) != this->radarObjects_.end() ); 128 134 Ogre::PanelOverlayElement* panel = this->radarObjects_[rv]; … … 172 178 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 173 179 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f); 174 it->second->show(); 180 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 181 it->second->show(); 182 else 183 it->second->hide(); 175 184 176 185 // if this object is in focus, then set the focus marker … … 184 193 } 185 194 195 bool HUDRadar::showObject(RadarViewable* rv) 196 { 197 if ( rv == dynamic_cast<RadarViewable*> ( this->getOwner() ) ) 198 return false; 199 assert( rv->getWorldEntity() ); 200 if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false ) 201 return false; 202 return true; 203 } 204 205 186 206 void HUDRadar::changedOwner() 187 207 { -
code/branches/ai2/src/modules/overlays/hud/HUDRadar.h
r7880 r8874 57 57 void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; } 58 58 59 void setDetectionLimit( float limit ) 60 { this->detectionLimit_ = limit; } 61 float getDetectionLimit() const 62 { return this->detectionLimit_; } 63 59 64 float getMaximumDotSize() const { return this->maximumDotSize_; } 60 65 void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } … … 69 74 virtual void objectChanged( RadarViewable* rv ); 70 75 void radarTick(float dt); 76 bool showObject( RadarViewable* rv ); //!< Do not display an object on radar, if showObject(.) is false. 71 77 72 78 void gatherObjects(); … … 83 89 84 90 float sensitivity_; 85 91 float detectionLimit_; 86 92 ControllableEntity* owner_; 87 93 };
Note: See TracChangeset
for help on using the changeset viewer.