- Timestamp:
- Oct 23, 2015, 7:44:20 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h
r10678 r10681 38 38 { 39 39 public: 40 DivisionController(Context* context);41 virtual ~DivisionController();40 DivisionController(Context* context); 41 virtual ~DivisionController(); 42 42 43 //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);43 //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 44 44 45 //Using british military aircraft formations 46 enum FormationMode {VEE,FINGER4,DIAMOND, WALL}; 47 void setFormationMode(FormationMode val); 48 inline FormationMode getFormationMode() const 49 { return this->formationMode_; } 50 51 virtual void doFire(); 45 52 53 //WAYPOINT FUNCTIONS` 54 void addWaypoint(WorldEntity* waypoint); 55 WorldEntity* getWaypoint(unsigned int index) const; 46 56 57 inline void setAccuracy(float accuracy) 58 { this->squaredaccuracy_ = accuracy*accuracy; } 59 inline float getAccuracy() const 60 { return sqrt(this->squaredaccuracy_); } 61 void updatePointsOfInterest(std::string name, float distance); 62 void manageWaypoints(); 47 63 48 64 protected: 49 65 50 66 //Target enemy, set by fleet controller. 67 WeakPtr<Pawn> target_; 68 bool bHasTargetPosition_; 69 Vector3 targetPosition_; 70 bool bHasTargetOrientation_; 71 Quaternion targetOrientation_; 72 void setTargetPosition(const Vector3& target); 73 void searchRandomTargetPosition(); 74 75 void setTargetOrientation(const Quaternion& orient); 76 void setTargetOrientation(Pawn* target); 77 78 virtual void positionReached() {} 79 80 static bool sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype); // hack 81 82 83 void setTarget(Pawn* target); 84 85 void searchNewTarget(); 86 void forgetTarget(); 87 88 void targetDied(); 89 bool bShooting_; 90 void aimAtTarget(); 91 92 bool isCloseAtTarget(float distance) const; 93 bool isLookingAtTarget(float angle) const; 94 95 //Has nothing to do with desiredRelativePosition_, 96 //is set by fleet controller. 97 Vector3* desiredAbsolutePosition_; 98 99 enum Maneuver {NONE, SPIN, TURN180}; 100 Maneuver maneuver_; 101 102 void moveToPosition(const Vector3& target); 103 void moveToTargetPosition(); 104 void absoluteMoveToPosition(const Vector3& target); 105 void copyOrientation(const Quaternion& orient); 106 void copyTargetOrientation(); 107 108 void turn180Init(); 109 void spinInit(); 110 void spin(); 111 void turn180(); 112 113 //WAYPOINT DATA 114 std::vector<WeakPtr<WorldEntity> > waypoints_; 115 size_t currentWaypoint_; 116 float squaredaccuracy_; 117 WorldEntity* defaultWaypoint_; 118 51 119 private: 52 120 };
Note: See TracChangeset
for help on using the changeset viewer.