- Timestamp:
- Nov 24, 2015, 10:37:28 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
r10849 r10851 39 39 #include "tools/interfaces/Tickable.h" 40 40 #include <limits> 41 #include <algorithm> 41 42 #include "worldentities/Actionpoint.h" 42 43 … … 90 91 virtual void tick(float dt); 91 92 92 //----[XML data]----93 //----[XML methods]---- 93 94 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 94 //----[Action data]---- 95 Action::Value getAction (); 96 void setAction (Action::Value action); 97 void setAction (Action::Value action, ControllableEntity* target); 98 void setAction (Action::Value action, const Vector3& target); 99 void setAction (Action::Value action, const Vector3& target, const Quaternion& orient ); 100 void setActionXML( std::string val); 101 std::string getActionXML(); 102 //----[/Action data]---- 103 //----[Formation data]---- 104 virtual void setFormationModeXML(std::string val); 105 virtual std::string getFormationModeXML(); 106 virtual void setFormationMode(FormationMode::Value val) 107 { this->formationMode_ = val; } 108 inline FormationMode::Value getFormationMode() const 109 { return this->formationMode_; } 110 //----[/Formation data]---- 111 //----[Rank data]---- 112 virtual void setRank(Rank::Value val) 113 { this->rank_ = val; } 114 inline Rank::Value getRank() const 115 { return this->rank_; } 116 //----[/Rank data]---- 117 //----[Protect data]---- 118 void setProtectXML( std::string val ); 119 std::string getProtectXML (); 120 void setProtect (ControllableEntity* protect); 121 ControllableEntity* getProtect (); 122 //----[/Protect data]---- 123 //----[Actionpoint data]---- 95 96 void setFormationModeXML(std::string val); 97 std::string getFormationModeXML(); 98 void setFormationMode(FormationMode::Value val); 99 FormationMode::Value getFormationMode() const; 100 101 void setRank(Rank::Value val); 102 Rank::Value getRank() const; 103 124 104 void addActionpoint(WorldEntity* waypoint); 125 105 WorldEntity* getActionpoint(unsigned int index) const; 126 //----[/Actionpoint data]---- 127 //----[/XML data]---- 106 //----[/XML methods]---- 128 107 129 108 //----[Interaction with other Controllers]---- 130 109 virtual bool setWingman(CommonController* wingman); 131 110 virtual bool hasWingman(); 132 133 void setPositionOfTarget(const Vector3& target); 134 void setOrientationOfTarget(const Quaternion& orient); 135 136 void setTarget(ControllableEntity* target); 111 112 bool hasTarget(); 137 113 ControllableEntity* getTarget(); 138 bool hasTarget(); 139 140 void setTargetPosition(const Vector3& target); 141 void setTargetOrientation(const Quaternion& orient); 142 void setTargetOrientation(ControllableEntity* target); 114 115 Action::Value getAction (); 116 std::string getActionName(); 117 118 void setAction (Action::Value action); 119 void setAction (Action::Value action, ControllableEntity* target); 120 void setAction (Action::Value action, const Vector3& target); 121 void setAction (Action::Value action, const Vector3& target, const Quaternion& orient ); 143 122 //----[/Interaction with other Controllers]---- 144 123 145 //----[Helper functions]----124 //----[Helper methods]---- 146 125 float randomInRange(float a, float b); 147 126 static float distance(ControllableEntity* entity1, ControllableEntity* entity2); … … 151 130 152 131 float squaredDistanceToTarget() const; 153 bool isLookingAtTarget(float angle) const; 154 //----[/Helper functions]---- 155 132 bool isLookingAtTarget(float angle); 133 //----[/Helper methods]---- 134 135 //----[Actionpoint information]---- 136 137 std::vector<WeakPtr<WorldEntity> > actionpoints_; 138 float squaredaccuracy_; 139 std::vector<Point > parsedActionpoints_; 140 141 //----[/Actionpoint information]---- 142 //----[Actionpoint methods]---- 143 void executeActionpoint(); 144 void nextActionpoint(); 145 //----[Actionpoint methods]---- 156 146 protected: 157 //----[Flying functionality]----147 //----[Flying methods]---- 158 148 void stopMoving(); 159 160 void moveToPoint(const Vector3& relativeTargetPosition, float angleRoll); 161 bool moveAndRoll(float dt); 149 void stopLookingAtTarget(); 150 void startLookingAtTarget(); 162 151 163 152 void moveToPosition(const Vector3& target, float dt); … … 168 157 169 158 void lookAtTarget(float dt); 170 void stopLookingAtTarget(); 171 void startLookingAtTarget(); 172 173 bool bLookAtTarget_; 174 //----[/Flying functionality]---- 159 160 void setTargetPosition(const Vector3& target); 161 void setTargetOrientation(const Quaternion& orient); 162 void setTargetOrientation(ControllableEntity* target); 163 164 165 //----[/Flying methods]---- 175 166 176 //----[Fighting functionality]---- 167 //----[Fighting methods]---- 168 void setTarget(ControllableEntity* target); 169 170 void setPositionOfTarget(const Vector3& target); 171 void setOrientationOfTarget(const Quaternion& orient); 172 173 void setProtect (ControllableEntity* protect); 174 ControllableEntity* getProtect (); 175 177 176 void maneuver(); 178 177 void dodge(Vector3& thisPosition, Vector3& diffUnit); 179 void aimAtTarget();180 178 bool canFire(); 181 179 void doFire(); 182 180 void setClosestTarget(); 183 181 Pawn* closestTarget(); 184 185 bool bShooting_; 186 int maneuverCounter_; 187 //----[/Fighting functionality]---- 182 bool startAttackingEnemiesThatAreClose(); 183 //----[/Fighting methods]---- 188 184 189 185 //----[where-to-fly information]---- 186 190 187 bool bHasTargetPosition_; 191 188 Vector3 targetPosition_; … … 193 190 Quaternion targetOrientation_; 194 191 195 196 192 //----[/where-to-fly information]---- 197 193 //----[protect information]---- … … 207 203 //----[/who-to-kill information]---- 208 204 209 //----[Actionpoint information]---- 210 std::vector<WeakPtr<WorldEntity> > actionpoints_; 211 float squaredaccuracy_; 212 Point currentActionpoint_; 213 std::vector<Point > parsedActionpoints_; 214 void executeActionpoint(); 215 void nextActionpoint(); 216 //----[/Actionpoint information]---- 205 217 206 //----["Private" variables]---- 218 207 FormationMode::Value formationMode_; … … 222 211 Action::Value action_; 223 212 int attackRange_; 224 213 bool bLookAtTarget_; 214 bool bShooting_; 215 int maneuverCounter_; 216 int tolerance_; 217 bool bFirstTick_; 225 218 //----[/"Private" variables]---- 226 219 };
Note: See TracChangeset
for help on using the changeset viewer.