Changeset 10028 for code/branches/ScriptableController/src
- Timestamp:
- Apr 10, 2014, 3:40:57 PM (11 years ago)
- Location:
- code/branches/ScriptableController/src/orxonox/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc
r10025 r10028 29 29 #include "ScriptController.h" 30 30 #include "core/CoreIncludes.h" 31 #include "worldentities/ControllableEntity.h" 31 32 32 33 namespace orxonox … … 34 35 RegisterClass(ScriptController); 35 36 36 ScriptController::ScriptController(Context* context, ControllableEntity CE) : ArtificialController(context) 37 //ScriptController::ScriptController(Context* context, ControllableEntity* CE) : ArtificialController(context) 38 ScriptController::ScriptController(Context* context) : ArtificialController(context) 37 39 { 38 40 RegisterObject(ScriptController); 39 set_controlled(CE);41 //set_controlled(CE); 40 42 } 41 43 42 void set_luasrc(std::string lsrc)44 void ScriptController::set_luasrc(std::string lsrc) 43 45 { 44 46 this->luasrc=lsrc; 45 47 } 46 48 47 void set_controlled(*ControllableEntitytoControl)49 void ScriptController::set_controlled(ControllableEntity* toControl) 48 50 { 49 51 this->controlled=toControl; … … 52 54 void ScriptController::XMLPort(Element& xmlelement, XMLPort::Mode mode) 53 55 { 54 XMLPort(ScriptController, BaseObject, "lsrc", set_luasrc, xmlelement, mode);56 //XMLPortParam(ScriptController, BaseObject, "lsrc", set_luasrc, xmlelement, mode); 55 57 56 58 } … … 58 60 void ScriptController::moveToPosition(const Vector3& target) 59 61 { 62 63 /*this->controlled_->rotateYaw(-sgn(coord.x)*coord.x*coord.x); 64 this->controlled_->rotatePitch(sgn(coord.y)*coord.y*coord.y);*/ 65 } 60 66 67 /*void WaypointController::tick(float dt) //copied from waypointcontroller 68 { 69 if (!this->isActive()) 70 return; 61 71 62 } 72 if (this->waypoints_.size() == 0 || !this->getControllableEntity()) 73 return; 74 75 if (this->waypoints_[this->currentWaypoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->squaredaccuracy_) 76 this->currentWaypoint_ = (this->currentWaypoint_ + 1) % this->waypoints_.size(); 77 78 this->moveToPosition(this->waypoints_[this->currentWaypoint_]->getWorldPosition()); 79 }*/ 80 63 81 /* TO DO 64 82 in the constuctor: make accessible functions such as moveToPosition.. in LUA 65 83 ->tolua++ example: http://usefulgamedev.weebly.com/tolua-example.html*/ 84 85 66 86 67 87 //function to execute the luafile -
code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h
r10025 r10028 30 30 #define _ScriptController_H__ 31 31 32 #include "OrxonoxPrereqs.h" 32 #include "OrxonoxPrereqs.h" /* die ganzen tolua, kopiert aus Dock.h*/ 33 33 #include "ArtificialController.h" 34 34 #include "core/EventIncludes.h" 35 35 36 36 37 namespace orxonox 38 { 39 class _OrxonoxExport ScriptController : public ArtificialController 40 { 37 namespace orxonox // tolua_export 38 { // tolua_export 39 class _OrxonoxExport ScriptController // tolua_export 40 : public ArtificialController 41 { // tolua_export 41 42 public: 42 ScriptController(Context* context, ControllableEntity CE); 43 //ScriptController(Context* context, ControllableEntity* CE); 44 ScriptController(Context* context); 45 43 46 virtual ~ScriptController() { } 44 47 … … 48 51 void set_luasrc(std::string); 49 52 50 void set_controlled( *ControllableEntity);53 void set_controlled(ControllableEntity*); 51 54 55 56 // LUA interface 57 // tolua_begin 52 58 void moveToPosition(const Vector3& target); 53 59 54 /* TO DO 55 - in the constuctor: make accessible functions such as moveToPoint.. in LUA 56 ->tolua++ example: http://usefulgamedev.weebly.com/tolua-example.html*/ 60 57 61 58 62 59 63 /* virtual void tick(float dt);*/ 60 64 61 // function to execute the luafile65 // tolua_end 62 66 63 67 private: … … 67 71 68 72 69 }; 70 } 73 };// tolua_export 74 } // tolua_export 71 75 72 76 #endif /* _ScriptController_H__ */
Note: See TracChangeset
for help on using the changeset viewer.