- Timestamp:
- Nov 22, 2015, 5:06:38 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
r10805 r10826 46 46 47 47 RegisterClass( CommonController ); 48 float SPEED = 0.9f/0.02f;49 float ROTATEFACTOR = 1.0f/0.02f;48 const float SPEED = 0.9f/0.02f; 49 const float ROTATEFACTOR = 1.0f/0.02f; 50 50 51 51 CommonController::CommonController( Context* context ): Controller( context ) … … 53 53 this->bSetupWorked = false; 54 54 55 this->executingManeuver_ = false;55 56 56 this->executingMoveToPoint_ = false; 57 57 this->action_ = Action::FLY; 58 58 this->stopLookingAtTarget(); 59 this->maneuverType_ = ManeuverType::NONE;59 60 60 RegisterObject( CommonController ); 61 61 } … … 64 64 CommonController::~CommonController() 65 65 { 66 orxout(internal_error) << "I died, my Rank is " << rank_ << endl;66 //orxout(internal_error) << "I died, my Rank is " << rank_ << endl; 67 67 } 68 68 … … 77 77 const std::string valUpper = getUppercase( val ); 78 78 FormationMode::Value value; 79 if ( valUpper == "VEE" ) 80 value = FormationMode::VEE; 81 else if ( valUpper == "WALL" ) 79 80 if ( valUpper == "WALL" ) 82 81 value = FormationMode::WALL; 83 82 else if ( valUpper == "FINGER4" ) … … 94 93 switch ( this->formationMode_ ) 95 94 { 96 case FormationMode::VEE:97 {98 return "VEE";99 break;100 }101 95 case FormationMode::WALL: 102 96 { … … 246 240 } 247 241 } 248 if ( this->getControllableEntity() && !this->target_ ) 249 { 250 251 this->maneuverType_ = ManeuverType::NONE; 252 } 242 253 243 //orxout ( internal_error ) << "ManeuverType = " << this->maneuverType_ << endl; 254 244 } … … 606 596 607 597 } 598 float CommonController::distance (ControllableEntity* entity1, ControllableEntity* entity2) 599 { 600 if (!entity1 || !entity2) 601 return std::numeric_limits<float>::infinity(); 602 return ( entity1->getPosition() - entity2->getPosition() ).length(); 603 } 604 bool CommonController::sameTeam (ControllableEntity* entity1, ControllableEntity* entity2) 605 { 606 if (!entity1 || !entity2) 607 return false; 608 return entity1->getTeam() == entity2->getTeam(); 609 } 608 610 void CommonController::doFire() 609 611 {
Note: See TracChangeset
for help on using the changeset viewer.