Changeset 7029 for code/branches/ai/src/orxonox/controllers
- Timestamp:
- May 30, 2010, 11:54:45 PM (14 years ago)
- Location:
- code/branches/ai/src/orxonox/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/AIController.cc
r6997 r7029 230 230 if (this->specificMasterAction_ == SPIN) 231 231 this->spin(); 232 if (this->specificMasterAction_ == FOLLOWHUMAN) 233 this->follow(); 232 234 } 233 235 -
code/branches/ai/src/orxonox/controllers/ArtificialController.cc
r6997 r7029 91 91 92 92 XMLPortParam(ArtificialController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1); 93 XMLPortParam(ArtificialController, "formation", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(true); 94 } 95 96 // Documentation only here to get a faster overview for creating a useful documentation, what you're reading here not intended for an actual documentation... 93 XMLPortParam(ArtificialController, "formationflight", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(true); 94 XMLPortParam(ArtificialController, "formation_size", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE); 95 } 96 97 // Documentation only here to get a faster overview for creating a useful documentation... 97 98 98 99 /** … … 231 232 232 233 /** 233 @brief Gets called if ControllableEntity ischanged. Resets the bot when it dies.234 @brief Gets called when ControllableEntity is being changed. Resets the bot when it dies. 234 235 */ 235 236 void ArtificialController::changedControllableEntity() … … 473 474 474 475 /** 475 @brief Master sets its slaves free for \var FREEDOM_COUNT seconds.476 @brief Master sets its slaves free for @var FREEDOM_COUNT seconds. 476 477 */ 477 478 void ArtificialController::forceFreeSlaves() … … 564 565 void ArtificialController::spinInit() 565 566 { 566 567 COUT(0) << "~spinInit" << std::endl; 567 568 if(this->state_ != MASTER) return; 568 569 this->specificMasterAction_ = SPIN; … … 582 583 @brief Master begins to follow a human player. Is a "specific master action". 583 584 @param humanController human to follow. 584 @param alaways follows human forever if true - only inplemented for false yet. 585 */ 586 void ArtificialController::followHuman(Pawn* human, bool always) 587 { 588 if (human == NULL) 589 { 590 this->specificMasterAction_ = NONE; 585 @param alaways follows human forever if true, else it follows it for @var SECONDS_TO_FOLLOW_HUMAN seconds. 586 */ 587 void ArtificialController::followHumanInit(Pawn* human, bool always) 588 { 589 COUT(0) << "~followInit" << std::endl; 590 if (human == NULL || this->state_ != MASTER) 591 591 return; 592 } 592 593 this->specificMasterAction_ = FOLLOWHUMAN; 594 595 this->setTarget(human); 593 596 if (!always) 594 {595 this->setTarget(human);596 597 this->specificMasterActionHoldCount_ = SECONDS_TO_FOLLOW_HUMAN; 597 this->specificMasterAction_ = HOLD; 598 } 599 600 } 598 else 599 this->specificMasterActionHoldCount_ = INT_MAX; //for now... 600 601 } 602 603 /** 604 @brief Follows target with adjusted speed. Called within tick. 605 */ 606 void ArtificialController::follow() 607 { 608 this->moveToTargetPosition(); //standard position apprach for now. 609 } 610 601 611 602 612 -
code/branches/ai/src/orxonox/controllers/ArtificialController.h
r6997 r7029 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Dominik Solenicki 26 26 * 27 27 */ … … 58 58 inline bool getFormationFlight() const 59 59 { return this->formationFlight_; } 60 inline void setFormationSize(int size) 61 { this->maxFormationSize_ = size; } 62 inline int getFormationSize() const 63 { return this->maxFormationSize_; } 60 64 virtual void changedControllableEntity(); 61 65 … … 105 109 void spinInit(); 106 110 void spin(); 107 void followHuman(Pawn* humanController, bool always); 111 void followHumanInit(Pawn* human, bool always); 112 void follow(); 108 113 109 114 void setTargetPosition(const Vector3& target);
Note: See TracChangeset
for help on using the changeset viewer.