- Timestamp:
- Nov 27, 2015, 9:25:52 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
r10869 r10871 45 45 namespace orxonox 46 46 { 47 48 namespace FormationMode49 {50 enum Value51 {52 FINGER4, DIAMOND, WALL53 };54 }55 56 57 58 59 60 47 class _OrxonoxExport CommonController : public Controller, public Tickable 61 48 { … … 70 57 virtual void tick(float dt); 71 58 72 //----[XML methods]---- 73 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 74 60 75 void setFormationModeXML(std::string val);76 std::string getFormationModeXML();77 void setFormationMode(FormationMode::Value val);78 FormationMode::Value getFormationMode() const;79 80 81 82 //----[/XML methods]----83 84 //----[Interaction with other Controllers]----85 virtual bool setWingman(CommonController* wingman);86 virtual bool hasWingman();87 88 bool hasTarget();89 ControllableEntity* getTarget();90 91 //----[/Interaction with other Controllers]----92 93 //----[Helper methods]----94 float randomInRange(float a, float b);95 static float distance(ControllableEntity* entity1, ControllableEntity* entity2);96 static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gt);97 static bool isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle ) ;98 static std::string getName( Pawn* entity ) ;99 100 float squaredDistanceToTarget() const;101 bool isLookingAtTarget(float angle);102 //----[/Helper methods]----103 104 105 protected:106 //----[Flying methods]----107 void stopMoving();108 void stopLookingAtTarget();109 void startLookingAtTarget();110 111 void moveToPosition(const Vector3& target, float dt);112 void moveToTargetPosition(float dt);113 114 void copyOrientation(const Quaternion& orient, float dt);115 void copyTargetOrientation(float dt);116 117 void lookAtTarget(float dt);118 119 void setTargetPosition(const Vector3& target);120 void setTargetOrientation(const Quaternion& orient);121 void setTargetOrientation(ControllableEntity* target);122 virtual void boostControl();123 61 124 62 125 //----[/Flying methods]---- 126 127 //----[Fighting methods]---- 128 void setTarget(ControllableEntity* target); 129 130 void setPositionOfTarget(const Vector3& target); 131 void setOrientationOfTarget(const Quaternion& orient); 63 virtual bool setWingman(CommonController* wingman); 64 virtual bool hasWingman(); 132 65 133 66 134 void maneuver(); 135 void dodge(Vector3& thisPosition, Vector3& diffUnit); 136 bool canFire(); 137 void doFire(); 67 float randomInRange(float a, float b); 68 static float distance(ControllableEntity* entity1, ControllableEntity* entity2); 69 static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gt); 70 static bool isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle ) ; 71 static std::string getName( Pawn* entity ) ; 138 72 139 //----[/Fighting methods]---- 73 protected: 74 75 bool bFirstTick_; 140 76 141 //----[where-to-fly information]----142 143 bool bHasTargetPosition_;144 Vector3 targetPosition_;145 bool bHasTargetOrientation_;146 Quaternion targetOrientation_;147 148 //----[/where-to-fly information]----149 //----[protect information]----150 WeakPtr<ControllableEntity> protect_;151 //----[/protect information]----152 //----[who-to-kill information]----153 WeakPtr<ControllableEntity> target_;154 155 bool bHasPositionOfTarget_;156 Vector3 positionOfTarget_;157 bool bHasOrientationOfTarget_;158 Quaternion orientationOfTarget_;159 //----[/who-to-kill information]----160 161 162 //----["Private" variables]----163 FormationMode::Value formationMode_;164 165 int attackRange_;166 bool bLookAtTarget_;167 bool bShooting_;168 int maneuverCounter_;169 int tolerance_;170 bool bFirstTick_;171 172 //----[/"Private" variables]----173 77 174 78 };
Note: See TracChangeset
for help on using the changeset viewer.