[10871] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
[10886] | 23 | * Gani Aliguzhinov |
---|
[10871] | 24 | * Co-authors: |
---|
[10886] | 25 | * Dominik Solenicki |
---|
[10871] | 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _FlyingController_H__ |
---|
| 30 | #define _FlyingController_H__ |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | #include "controllers/CommonController.h" |
---|
| 34 | |
---|
| 35 | namespace orxonox |
---|
| 36 | { |
---|
[10898] | 37 | /** |
---|
| 38 | @brief |
---|
| 39 | FlyingController stores all the flying methods and member variables of AI. |
---|
| 40 | */ |
---|
[10871] | 41 | namespace FormationMode |
---|
| 42 | { |
---|
| 43 | enum Value |
---|
| 44 | { |
---|
| 45 | FINGER4, DIAMOND, WALL |
---|
| 46 | }; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | class _OrxonoxExport FlyingController : public CommonController |
---|
| 50 | { |
---|
| 51 | |
---|
| 52 | public: |
---|
[10877] | 53 | static const float SPEED = 0.9f/0.02f; |
---|
| 54 | static const float ROTATEFACTOR = 0.6f/0.02f; |
---|
| 55 | |
---|
[10871] | 56 | FlyingController(Context* context); |
---|
| 57 | virtual ~FlyingController(); |
---|
| 58 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 59 | |
---|
| 60 | void setSpread (int spread) |
---|
| 61 | { this->spread_ = spread; } |
---|
[10885] | 62 | int getSpread () const |
---|
[10871] | 63 | { return this->spread_; } |
---|
| 64 | |
---|
| 65 | void setFormationModeXML(std::string val); |
---|
[10885] | 66 | std::string getFormationModeXML() const; |
---|
[10871] | 67 | |
---|
| 68 | void setFormationMode(FormationMode::Value val) |
---|
| 69 | { this->formationMode_ = val; } |
---|
| 70 | FormationMode::Value getFormationMode() const |
---|
| 71 | { return this->formationMode_; } |
---|
| 72 | |
---|
| 73 | protected: |
---|
| 74 | void stopMoving(); |
---|
| 75 | |
---|
| 76 | void moveToPosition(const Vector3& target, float dt); |
---|
| 77 | void moveToTargetPosition(float dt); |
---|
| 78 | |
---|
| 79 | void copyOrientation(const Quaternion& orient, float dt); |
---|
| 80 | void copyTargetOrientation(float dt); |
---|
| 81 | |
---|
| 82 | void setTargetPosition(const Vector3& target); |
---|
| 83 | void setTargetOrientation(const Quaternion& orient); |
---|
| 84 | void setTargetOrientation(ControllableEntity* target); |
---|
[10886] | 85 | virtual void boostControl(); |
---|
| 86 | void keepFormation (const ControllableEntity* leaderEntity, Vector3& targetRelativePosition); |
---|
[10923] | 87 | |
---|
[10871] | 88 | FormationMode::Value formationMode_; |
---|
| 89 | |
---|
[10923] | 90 | float rotationProgress_; //<! for slerp |
---|
[10871] | 91 | bool bHasTargetPosition_; |
---|
| 92 | Vector3 targetPosition_; |
---|
| 93 | bool bHasTargetOrientation_; |
---|
| 94 | Quaternion targetOrientation_; |
---|
| 95 | int spread_; |
---|
| 96 | int tolerance_; |
---|
| 97 | }; |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | #endif /* _FlyingController_H__ */ |
---|