- Timestamp:
- Oct 26, 2015, 5:44:31 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
r10682 r10709 32 32 namespace orxonox 33 33 { 34 const float WingmanController::ACTION_INTERVAL = 1.0f;35 34 36 35 RegisterClass(WingmanController); 37 36 38 WingmanController::WingmanController(Context* context) : SectionController(context)37 WingmanController::WingmanController(Context* context) : Controller(context) 39 38 { 40 39 RegisterObject(WingmanController); 41 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this)));40 //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this))); 42 41 } 43 42 … … 55 54 void WingmanController::action() 56 55 { 57 //--------------------------Cover Leader's rear-------------------------- 58 //check for enemies in Leader's rear that can attack him and if they are visible, meaning there are no other Leader's between Leader and enemies. 59 //if there are enemies, set target_ to the nearest one and set bFollowLeader_ to false, 60 //otherwise set bFollowLeader_ to true and target_ to sectionTarget_ 61 this->coverAllyRear(this->sectionLeader_); 56 //this->target_ = this->sectionTarget_; 62 57 } 63 58 64 59 void WingmanController::tick(float dt) 65 { 60 {/* 66 61 if (!this->isActive()) 67 62 return; … … 69 64 if (bFollowLeader_) 70 65 { 71 this->keepSectionTick(); 66 this->keepSectionTick();*/ 72 67 /*keepSectionTick(){ 73 68 if (this->sectionLeader_ && this->sectionLeader_->getControllableEntity() && desiredRelativePosition_){ … … 78 73 } 79 74 */ 80 75 /* 81 76 //--------------------------Attack same target as the Leader-------------------------- 82 77 83 78 if (this->target_) 84 79 { … … 86 81 this->doFire(); 87 82 } 88 } 89 //--------------------------Protect Leader by killing target_-------------------------- 90 91 else 92 { 93 if (this->target_) 94 { 95 //--------------------------Don't attack if not visible-------------------------- 96 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 97 { 98 this->forgetTarget(); 99 //this->bFollowLeader_ = true; 100 } 101 //--------------------------Otherwise destroy it-------------------------- 102 else 103 { 104 this->aimAtTarget(); 105 this->follow(); //If a bot is shooting a player, it shouldn't let him go away easily. 106 } 107 if (this->bHasTargetPosition_) 108 { 109 this->moveToTargetPosition(); 110 } 111 this->doFire(); 112 } 113 //--------------------------no target? do nothing until next action() -> either new target appears or bFollowLeader_ set to true-------------------------- 114 else 115 { 116 117 } 118 119 } 83 }*/ 84 //orxout(internal_error) << "I am " << this << endl; 85 120 86 SUPER(WingmanController, tick, dt); 121 87 }
Note: See TracChangeset
for help on using the changeset viewer.