Changeset 10958 for code/branches/campaignHS15/src
- Timestamp:
- Dec 8, 2015, 1:02:25 PM (9 years ago)
- Location:
- code/branches/campaignHS15/src/orxonox/controllers
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
r10955 r10958 298 298 } 299 299 } 300 301 302 300 } 303 301 /** … … 307 305 void ActionpointController::setProtect (ControllableEntity* protect) 308 306 { 309 310 307 this->protect_ = protect; 311 308 } 312 309 ControllableEntity* ActionpointController::getProtect () 313 310 { 314 315 311 return this->protect_; 316 312 } -
code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
r10955 r10958 60 60 virtual void maneuver(); //<! sets this->targetPosition_, which is a Vector3 of where this ship flies. Decision is made based on 61 61 //<! the distance to enemy, if being attacked, dodge() is called, otherwise ship just flies towards this->target_. 62 bool bShooting_; 62 bool bShooting_; //<! if true, ship shoots each tick 63 63 bool canFire(); //<! check if target_ is in radius and if this is looking at target_ 64 virtual void action(){};//<! action() is called in regular intervals managing the bot's behaviour. Only gets called by MasterController, is implemented in ActionpointController65 64 protected: 66 65 void setTarget(ControllableEntity* target); //set a target to shoot at -
code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc
r10946 r10958 45 45 this->spread_ = 200; 46 46 this->tolerance_ = 80; 47 this->bCopyOrientation_ = true; 47 48 } 48 49 FlyingController::~FlyingController() … … 266 267 + (orient* (targetRelativePosition))); 267 268 //let ship finish rotating. also don't call copyOrientation too often as it is a slow function. Don't know how to do it different 268 if ( static_cast<int>(rnd(1.0f) * 100) % 3 == 0)269 if (this->bCopyOrientation_) 269 270 this->setTargetOrientation (orient); 270 271 //set a position to fly to -
code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h
r10946 r10958 72 72 FormationMode::Value getFormationMode() const 73 73 { return this->formationMode_; } 74 74 bool bCopyOrientation_; //<! set to true by default, MasterController sets it in its tick(), 75 //<! if true, this will set its leader orientation as target orientation in action() 75 76 protected: 76 77 void stopMoving(); //<! don't call moveToTargetPosition() in tick, call lookAtTarget() from FightingController instead … … 86 87 void setTargetOrientation(ControllableEntity* target); //<! preset a desired orientation 87 88 virtual void boostControl(); //<! boost if you can 88 void keepFormation (const ControllableEntity* leaderEntity, Vector3& targetRelativePosition); //<! preset targetPosition, so that 89 //<! this stays in a certain position relative to leader 89 void keepFormation (const ControllableEntity* leaderEntity, 90 Vector3& targetRelativePosition); //<! preset targetPosition, so that 91 //<! this stays in a certain position relative to leader 90 92 91 93 FormationMode::Value formationMode_; -
code/branches/campaignHS15/src/orxonox/controllers/MasterController.cc
r10955 r10958 35 35 36 36 //Leaders share the fact that they have Wingmans 37 MasterController::MasterController(Context* context) : FightingController(context)37 MasterController::MasterController(Context* context) : Controller(context) 38 38 { 39 39 RegisterObject(MasterController); … … 120 120 } 121 121 //orxout (internal_error) << "Executing action of Controller # " << this->indexOfCurrentController_ << endl; 122 this->controllers_.at(this->indexOfCurrentController_)->action(); 122 this->controllers_.at(this->indexOfCurrentController_)->action(); 123 //bCopyOrientation makes ship oscillate like crazy if set to true all the time.s 124 this->controllers_.at(this->indexOfCurrentController_)->bCopyOrientation_ = this->ticks_ % 3 == 0; 123 125 124 126 ++this->numberOfTicksPassedSinceLastActionCall_; -
code/branches/campaignHS15/src/orxonox/controllers/MasterController.h
r10955 r10958 30 30 #define _MasterController_H__ 31 31 32 #include "controllers/FightingController.h" 32 #include "controllers/Controller.h" 33 #include "controllers/ActionpointController.h" 33 34 #include "tools/interfaces/Tickable.h" 34 35 … … 50 51 </Pawn> 51 52 */ 52 class _OrxonoxExport MasterController : public FightingController, public Tickable53 class _OrxonoxExport MasterController : public Controller, public Tickable 53 54 { 54 55 public: … … 67 68 68 69 private: 69 std::vector<WeakPtr< FightingController> > controllers_; //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called70 std::vector<WeakPtr<ActionpointController> > controllers_; //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called 70 71 size_t indexOfCurrentController_; //<! index of current controller 71 72 unsigned int numberOfTicksPassedSinceLastActionCall_;
Note: See TracChangeset
for help on using the changeset viewer.