[10678] | 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 | * Dominik Solenicki |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _DivisionController_H__ |
---|
| 30 | #define _DivisionController_H__ |
---|
| 31 | |
---|
[10709] | 32 | #include "controllers/LeaderController.h" |
---|
[10678] | 33 | |
---|
| 34 | |
---|
[10709] | 35 | |
---|
[10678] | 36 | namespace orxonox |
---|
| 37 | { |
---|
[10709] | 38 | class _OrxonoxExport DivisionController : public LeaderController |
---|
[10678] | 39 | { |
---|
| 40 | public: |
---|
[10681] | 41 | DivisionController(Context* context); |
---|
| 42 | virtual ~DivisionController(); |
---|
[10678] | 43 | |
---|
[10681] | 44 | //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[10678] | 45 | |
---|
[10681] | 46 | //Using british military aircraft formations |
---|
| 47 | enum FormationMode {VEE,FINGER4,DIAMOND, WALL}; |
---|
| 48 | void setFormationMode(FormationMode val); |
---|
| 49 | inline FormationMode getFormationMode() const |
---|
| 50 | { return this->formationMode_; } |
---|
[10709] | 51 | virtual void setLeader(LeaderController* leader); |
---|
| 52 | |
---|
[10681] | 53 | |
---|
[10678] | 54 | |
---|
| 55 | protected: |
---|
| 56 | |
---|
[10681] | 57 | //Target enemy, set by fleet controller. |
---|
| 58 | WeakPtr<Pawn> target_; |
---|
| 59 | bool bHasTargetPosition_; |
---|
| 60 | Vector3 targetPosition_; |
---|
| 61 | bool bHasTargetOrientation_; |
---|
| 62 | Quaternion targetOrientation_; |
---|
[10709] | 63 | FormationMode formationMode_; |
---|
| 64 | |
---|
| 65 | /*void setTargetPosition(const Vector3& target); |
---|
[10681] | 66 | void searchRandomTargetPosition(); |
---|
| 67 | |
---|
| 68 | void setTargetOrientation(const Quaternion& orient); |
---|
| 69 | void setTargetOrientation(Pawn* target); |
---|
| 70 | |
---|
| 71 | virtual void positionReached() {} |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | void setTarget(Pawn* target); |
---|
| 76 | |
---|
| 77 | void searchNewTarget(); |
---|
| 78 | void forgetTarget(); |
---|
| 79 | |
---|
| 80 | void targetDied(); |
---|
| 81 | bool bShooting_; |
---|
| 82 | void aimAtTarget(); |
---|
| 83 | |
---|
| 84 | bool isCloseAtTarget(float distance) const; |
---|
| 85 | bool isLookingAtTarget(float angle) const; |
---|
| 86 | |
---|
| 87 | //Has nothing to do with desiredRelativePosition_, |
---|
| 88 | //is set by fleet controller. |
---|
| 89 | Vector3* desiredAbsolutePosition_; |
---|
| 90 | |
---|
| 91 | enum Maneuver {NONE, SPIN, TURN180}; |
---|
| 92 | Maneuver maneuver_; |
---|
| 93 | |
---|
| 94 | void moveToPosition(const Vector3& target); |
---|
| 95 | void moveToTargetPosition(); |
---|
| 96 | void absoluteMoveToPosition(const Vector3& target); |
---|
| 97 | void copyOrientation(const Quaternion& orient); |
---|
| 98 | void copyTargetOrientation(); |
---|
| 99 | |
---|
| 100 | void turn180Init(); |
---|
| 101 | void spinInit(); |
---|
| 102 | void spin(); |
---|
[10709] | 103 | void turn180();*/ |
---|
[10681] | 104 | |
---|
[10709] | 105 | LeaderController* leader_; |
---|
| 106 | |
---|
| 107 | |
---|
[10681] | 108 | |
---|
[10678] | 109 | private: |
---|
| 110 | }; |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | #endif /* _DivisionController_H__ */ |
---|