[11165] | 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 | |
---|
[11172] | 32 | #include "DebugTask.h" |
---|
[11178] | 33 | #include "stringOutTask.h" |
---|
[11165] | 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 | |
---|
[11178] | 60 | void debugOut(float startTime);// tolua_export |
---|
[11167] | 61 | |
---|
[11178] | 62 | void stringOut(float startTime, std::string output);// tolua_export |
---|
| 63 | |
---|
[11172] | 64 | static NewScriptController* getNewScriptController();// tolua_export |
---|
[11167] | 65 | |
---|
[11172] | 66 | int getID() { return ctrlid_; }// tolua_export |
---|
[11167] | 67 | |
---|
[11178] | 68 | void printDebug() {orxout() << "fffff" << endl;} // tolua_export |
---|
[11167] | 69 | |
---|
[11178] | 70 | |
---|
[11165] | 71 | void createAndAddTask(Task newTask); |
---|
| 72 | |
---|
| 73 | private: |
---|
[11167] | 74 | // Information about the player that this ScriptController will |
---|
| 75 | // control |
---|
| 76 | // - Player pointer |
---|
[11165] | 77 | PlayerInfo* player_; |
---|
| 78 | |
---|
[11167] | 79 | // - Entity pointer, this is for convenience and will be the same as |
---|
| 80 | // player_->getControllableEntity() |
---|
[11165] | 81 | ControllableEntity* entity_; |
---|
| 82 | |
---|
[11167] | 83 | // Controller ID, defaults to 0 and is set using takeControl() |
---|
| 84 | int ctrlid_; |
---|
| 85 | |
---|
| 86 | // List of events to walk through |
---|
[11178] | 87 | std::queue<Task*> taskQueue_; |
---|
[11165] | 88 | |
---|
| 89 | |
---|
[11167] | 90 | //List of Tasks currently active |
---|
[11178] | 91 | std::vector<Task*> activeTasks_; |
---|
[11165] | 92 | |
---|
[11167] | 93 | // Time since the creation of this ScriptController object |
---|
[11165] | 94 | float scTime_; |
---|
| 95 | |
---|
| 96 | |
---|
[11178] | 97 | // context of the Controller to create the tasks |
---|
| 98 | Context* context_; |
---|
[11172] | 99 | |
---|
| 100 | |
---|
[11165] | 101 | };// tolua_export |
---|
| 102 | } // tolua_export |
---|
| 103 | |
---|
| 104 | #endif /* _NewScriptController_H__ */ |
---|