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 | * Paul Lehmann |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _NewScriptController_H__ |
---|
30 | #define _NewScriptController_H__ |
---|
31 | |
---|
32 | #include "DebugTask.h" |
---|
33 | #include "stringOutTask.h" |
---|
34 | #include "Task.h" |
---|
35 | #include "OrxonoxPrereqs.h" /* die ganzen tolua, kopiert aus Dock.h*/ |
---|
36 | #include "ArtificialController.h" |
---|
37 | #include "core/EventIncludes.h" |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | namespace orxonox // tolua_export |
---|
42 | { // tolua_export |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | class _OrxonoxExport NewScriptController // tolua_export |
---|
47 | : public ArtificialController, public Tickable |
---|
48 | { // tolua_export |
---|
49 | public: |
---|
50 | NewScriptController(Context* context); |
---|
51 | virtual ~NewScriptController() { } |
---|
52 | |
---|
53 | void takeControl(int ctrlid); |
---|
54 | void setPlayer(PlayerInfo* player) { this->player_ = player; } |
---|
55 | |
---|
56 | virtual void tick(float dt) override; |
---|
57 | |
---|
58 | // LUA interface |
---|
59 | |
---|
60 | void debugOut(float startTime);// tolua_export |
---|
61 | |
---|
62 | void stringOut(float startTime, std::string output);// tolua_export |
---|
63 | |
---|
64 | static NewScriptController* getNewScriptController();// tolua_export |
---|
65 | |
---|
66 | int getID() { return ctrlid_; }// tolua_export |
---|
67 | |
---|
68 | void printDebug() {orxout() << "fffff" << endl;} // tolua_export |
---|
69 | |
---|
70 | |
---|
71 | void createAndAddTask(Task newTask); |
---|
72 | |
---|
73 | private: |
---|
74 | // Information about the player that this ScriptController will |
---|
75 | // control |
---|
76 | // - Player pointer |
---|
77 | PlayerInfo* player_; |
---|
78 | |
---|
79 | // - Entity pointer, this is for convenience and will be the same as |
---|
80 | // player_->getControllableEntity() |
---|
81 | ControllableEntity* entity_; |
---|
82 | |
---|
83 | // Controller ID, defaults to 0 and is set using takeControl() |
---|
84 | int ctrlid_; |
---|
85 | |
---|
86 | // List of events to walk through |
---|
87 | std::queue<Task*> taskQueue_; |
---|
88 | |
---|
89 | |
---|
90 | //List of Tasks currently active |
---|
91 | std::vector<Task*> activeTasks_; |
---|
92 | |
---|
93 | // Time since the creation of this ScriptController object |
---|
94 | float scTime_; |
---|
95 | |
---|
96 | |
---|
97 | // context of the Controller to create the tasks |
---|
98 | Context* context_; |
---|
99 | |
---|
100 | |
---|
101 | };// tolua_export |
---|
102 | } // tolua_export |
---|
103 | |
---|
104 | #endif /* _NewScriptController_H__ */ |
---|