Changeset 11172
- Timestamp:
- Apr 21, 2016, 4:02:06 PM (9 years ago)
- Location:
- code/branches/plehmannFS16/src/orxonox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/plehmannFS16/src/orxonox/CMakeLists.txt
r11080 r11172 64 64 infos/PlayerInfo.h 65 65 sound/SoundManager.h 66 controllers/ ScriptController.h66 controllers/NewScriptController.h 67 67 PCH_FILE 68 68 OrxonoxPrecompiledHeaders.h -
code/branches/plehmannFS16/src/orxonox/OrxonoxPrereqs.h
r11080 r11172 98 98 class HumanController; 99 99 class ScriptController; 100 class NewScriptController; 100 101 class WaypointController; 101 102 class WaypointPatrolController; -
code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt
r11167 r11172 21 21 NewScriptController.cc 22 22 Task.cc 23 DebugTask.cc 23 24 ) -
code/branches/plehmannFS16/src/orxonox/controllers/ControllerDirector.cc
r11167 r11172 105 105 * the next time it is triggered */ 106 106 ctrlid += 1; 107 108 orxout()<<"swag"<< endl; 107 109 } 108 110 … … 121 123 122 124 // Check if there actually was a player returned. 123 if( this->player_ == nullptr) return false; 125 if( this->player_ == nullptr) { 126 orxout()<<"swag control"<< endl; 127 128 return false; 129 } 124 130 } 125 131 else -
code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc
r11167 r11172 39 39 RegisterClass(DebugTask); 40 40 41 DebugTask::DebugTask(Context* context) : isRunning_(false)41 DebugTask::DebugTask(Context* context): Task(context) 42 42 { 43 43 RegisterObject(DebugTask); 44 44 } 45 45 46 DebugTask::Tick(float dt)46 void DebugTask::tick(float dt) 47 47 { 48 48 SUPER(DebugTask, tick, dt); 49 49 orxout() << "*" << endl; 50 50 } -
code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.h
r11167 r11172 33 33 #include "controllers/ArtificialController.h" 34 34 #include "tools/interfaces/Tickable.h" 35 #include "Task.h" 35 36 36 37 namespace orxonox 37 38 { 38 class _OrxonoxExport Task : public Task39 class _OrxonoxExport DebugTask : public Task 39 40 { 40 41 public: 41 42 DebugTask(Context* context); 42 virtual ~ Task();43 virtual ~DebugTask(){} 43 44 44 //this function needs to be called otherwise the task is never carriedout45 initialize()45 void initialize(float startTime) 46 {this->startTime_ = startTime;} 46 47 47 48 virtual void tick(float dt) override; -
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
r11167 r11172 44 44 #include "NewScriptController.h" 45 45 46 #include "DebugTask.h" 46 47 #include "Task.h" 47 48 #include "infos/PlayerInfo.h" 48 49 #include "core/CoreIncludes.h" 49 50 #include "worldentities/ControllableEntity.h" 50 #include "core/LuaState.h"51 51 #include "core/LuaState.h" 52 52 #include "util/Math.h" … … 69 69 this->scTime_ = 0.0f; 70 70 71 //taskList_->push(new DebugTask); 71 this->context_ = context; 72 73 task_ = new DebugTask(context); 74 75 //taskQueue_->push(new DebugTask); 72 76 73 77 } … … 111 115 SUPER(NewScriptController, tick, dt); 112 116 113 /* 117 114 118 // If this controller has no entity entry, do nothing 115 119 if( !(this->entity_) ) return; 116 120 117 // See if time has come for the next event to be run 118 if(this->taskList_->size() > 0 && this->taskList_->front().getStartTime() <= scTime_) 119 { // Execute the next event on the list 120 activeTasks_->push_back(taskList_->front()); 121 taskList_->pop(); 122 } 123 124 // Update the local timers in this object 125 scTime_ += dt; 126 127 // tick active tasks and delete completed tasks 128 for(std::vector<Task>::iterator it = activeTasks_->begin(); it != activeTasks_->end(); it++) 129 { 130 it->tick(dt); 131 if ( !(it->getIsRunning()) ) 132 { 133 activeTasks_->erase(it); 134 it--; 135 } 136 137 } 138 */ 121 taskQueue_->first()->tick(); 139 122 } 140 123 … … 142 125 void NewScriptController::createAndAddTask(Task newTask) 143 126 { 144 task List_->push(newTask);127 taskQueue_->push(newTask); 145 128 } 146 129 147 void NewScriptController::debugOut( )130 void NewScriptController::debugOut(float startTime) 148 131 { 149 orxout() << "NewScriptController: Taking control" << endl; 132 DebugTask* task = new DebugTask(context); 133 task->initialize(10000); 134 taskQueue_->push(task); 150 135 } 151 136 152 NewScriptController* NewScriptController::getNewScriptController() 137 NewScriptController* NewScriptController::getNewScriptController() 153 138 { 154 139 /* Output a message that confirms this function was called */ -
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h
r11167 r11172 30 30 #define _NewScriptController_H__ 31 31 32 #include "DebugTask.h" 32 33 #include "Task.h" 33 34 #include "OrxonoxPrereqs.h" /* die ganzen tolua, kopiert aus Dock.h*/ … … 55 56 56 57 // LUA interface 57 // tolua_begin58 58 59 void debugOut( );59 void debugOut(float startTime);// tolua_export 60 60 61 static NewScriptController* getNewScriptController(); 61 static NewScriptController* getNewScriptController();// tolua_export 62 62 63 int getID() { return ctrlid_; } 63 int getID() { return ctrlid_; }// tolua_export 64 64 65 //tolua_end66 65 67 66 void createAndAddTask(Task newTask); … … 81 80 82 81 // List of events to walk through 83 std::queue<Task >* taskList_;82 std::queue<Task*>* taskQueue_; 84 83 85 84 86 85 //List of Tasks currently active 87 std::vector<Task >* activeTasks_;86 std::vector<Task*>* activeTasks_; 88 87 89 88 // Time since the creation of this ScriptController object 90 89 float scTime_; 90 91 DebugTask* task_; 92 93 context* context_; 91 94 92 95 -
code/branches/plehmannFS16/src/orxonox/controllers/ScriptController.cc
r11152 r11172 46 46 #include "core/CoreIncludes.h" 47 47 #include "worldentities/ControllableEntity.h" 48 #include "core/LuaState.h"49 48 #include "core/LuaState.h" 50 49 #include "util/Math.h" -
code/branches/plehmannFS16/src/orxonox/controllers/Task.cc
r11167 r11172 31 31 32 32 #include "infos/PlayerInfo.h" 33 //#include "controllers/ArtificialController.h"34 33 #include "tools/interfaces/Tickable.h" 35 34 … … 44 43 startTime_ = -1; 45 44 } 46 Task::~Task()47 {48 45 49 } 50 /* 51 Task::initialize(float startTime) 46 void Task::initialize(float startTime) 52 47 { 53 48 startTime_ = startTime; 54 49 } 55 */ 50 56 51 void Task::tick(float dt) 57 52 { 58 53 SUPER(Task, tick, dt); 59 54 } 60 55 -
code/branches/plehmannFS16/src/orxonox/controllers/Task.h
r11167 r11172 31 31 32 32 #include "infos/PlayerInfo.h" 33 //#include "controllers/ArtificialController.h"34 33 #include "tools/interfaces/Tickable.h" 35 34 … … 40 39 public: 41 40 Task(Context* context); 42 virtual ~Task() ;41 virtual ~Task(){} 43 42 44 43 //this function needs to be called otherwise the task is never carriedout 45 //initialize();44 void initialize(float startTime); 46 45 47 46 virtual void tick(float dt) override; … … 56 55 {return startTime_;} 57 56 58 57 //private: 59 58 60 59 bool isRunning_;
Note: See TracChangeset
for help on using the changeset viewer.