| 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: |
|---|
| 23 | * Fabian 'x3n' Landau |
|---|
| 24 | * Co-authors: |
|---|
| 25 | * ... |
|---|
| 26 | * |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| 29 | #ifndef _FlyingController_H__ |
|---|
| 30 | #define _FlyingController_H__ |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | #include "controllers/CommonController.h" |
|---|
| 34 | |
|---|
| 35 | namespace orxonox |
|---|
| 36 | { |
|---|
| 37 | const float SPEED = 0.9f/0.02f; |
|---|
| 38 | const float ROTATEFACTOR = 1.0f/0.02f; |
|---|
| 39 | namespace FormationMode |
|---|
| 40 | { |
|---|
| 41 | enum Value |
|---|
| 42 | { |
|---|
| 43 | FINGER4, DIAMOND, WALL |
|---|
| 44 | }; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | class _OrxonoxExport FlyingController : public CommonController |
|---|
| 50 | { |
|---|
| 51 | |
|---|
| 52 | public: |
|---|
| 53 | FlyingController(Context* context); |
|---|
| 54 | virtual ~FlyingController(); |
|---|
| 55 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
|---|
| 56 | |
|---|
| 57 | void setSpread (int spread) |
|---|
| 58 | { this->spread_ = spread; } |
|---|
| 59 | int getSpread () |
|---|
| 60 | { return this->spread_; } |
|---|
| 61 | |
|---|
| 62 | void setFormationModeXML(std::string val); |
|---|
| 63 | std::string getFormationModeXML(); |
|---|
| 64 | |
|---|
| 65 | void setFormationMode(FormationMode::Value val) |
|---|
| 66 | { this->formationMode_ = val; } |
|---|
| 67 | FormationMode::Value getFormationMode() const |
|---|
| 68 | { return this->formationMode_; } |
|---|
| 69 | |
|---|
| 70 | protected: |
|---|
| 71 | void stopMoving(); |
|---|
| 72 | |
|---|
| 73 | void moveToPosition(const Vector3& target, float dt); |
|---|
| 74 | void moveToTargetPosition(float dt); |
|---|
| 75 | |
|---|
| 76 | void copyOrientation(const Quaternion& orient, float dt); |
|---|
| 77 | void copyTargetOrientation(float dt); |
|---|
| 78 | |
|---|
| 79 | void setTargetPosition(const Vector3& target); |
|---|
| 80 | void setTargetOrientation(const Quaternion& orient); |
|---|
| 81 | void setTargetOrientation(ControllableEntity* target); |
|---|
| 82 | virtual void boostControl(); |
|---|
| 83 | FormationMode::Value formationMode_; |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | bool bHasTargetPosition_; |
|---|
| 87 | Vector3 targetPosition_; |
|---|
| 88 | bool bHasTargetOrientation_; |
|---|
| 89 | Quaternion targetOrientation_; |
|---|
| 90 | int spread_; |
|---|
| 91 | int tolerance_; |
|---|
| 92 | }; |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | #endif /* _FlyingController_H__ */ |
|---|