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 _SectionController_H__ |
---|
30 | #define _SectionController_H__ |
---|
31 | |
---|
32 | #include "controllers/LeaderController.h" |
---|
33 | |
---|
34 | #include "tools/Timer.h" |
---|
35 | #include "tools/interfaces/Tickable.h" |
---|
36 | |
---|
37 | namespace orxonox |
---|
38 | { |
---|
39 | class _OrxonoxExport SectionController : public LeaderController, public Tickable |
---|
40 | { |
---|
41 | public: |
---|
42 | SectionController(Context* context); |
---|
43 | virtual ~SectionController(); |
---|
44 | virtual bool setWingman(CommonController* cwingman) |
---|
45 | { |
---|
46 | WeakPtr<WingmanController> wingman = orxonox_cast<WingmanController*>(cwingman); |
---|
47 | |
---|
48 | if (!this->myWingman_) |
---|
49 | { |
---|
50 | this->myWingman_ = wingman; |
---|
51 | return true; |
---|
52 | } |
---|
53 | else |
---|
54 | { |
---|
55 | return false; |
---|
56 | } |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | virtual bool hasWingman() |
---|
61 | { |
---|
62 | if (this->myWingman_) |
---|
63 | return true; |
---|
64 | else |
---|
65 | return false; |
---|
66 | } |
---|
67 | |
---|
68 | virtual void tick(float dt); //<! Carrying out the targets set in action(). |
---|
69 | |
---|
70 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
71 | LeaderController* findNewDivisionLeader(); |
---|
72 | |
---|
73 | protected: |
---|
74 | void setTargetPositionOfWingman(); |
---|
75 | //A division is the biggest block of spaceships. |
---|
76 | //In division one section is leading, the other one always stays on the same position |
---|
77 | //relative to the Leader of the leading section. |
---|
78 | //In section a Wingman always stays on same position relative to the Leader. |
---|
79 | //That position is desiredRelativePosition_ |
---|
80 | virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets. |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | private: |
---|
87 | Timer actionTimer_; //<! Regularly calls action(). |
---|
88 | |
---|
89 | |
---|
90 | }; |
---|
91 | } |
---|
92 | |
---|
93 | #endif /* _SectionController_H__ */ |
---|