Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10028


Ignore:
Timestamp:
Apr 10, 2014, 3:40:57 PM (10 years ago)
Author:
samuezu
Message:

compiles now

Location:
code/branches/ScriptableController/src/orxonox/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc

    r10025 r10028  
    2929#include "ScriptController.h"
    3030#include "core/CoreIncludes.h"
     31#include "worldentities/ControllableEntity.h"
    3132
    3233namespace orxonox
     
    3435    RegisterClass(ScriptController);
    3536
    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)
    3739    {
    3840        RegisterObject(ScriptController);
    39         set_controlled(CE);
     41        //set_controlled(CE);
    4042    }
    4143
    42     void set_luasrc(std::string lsrc)
     44    void ScriptController::set_luasrc(std::string lsrc)
    4345    {
    4446        this->luasrc=lsrc;
    4547    }
    4648
    47     void set_controlled(*ControllableEntity toControl)
     49    void ScriptController::set_controlled(ControllableEntity* toControl)
    4850    {
    4951        this->controlled=toControl;
     
    5254    void ScriptController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5355    {
    54         XMLPort(ScriptController, BaseObject, "lsrc", set_luasrc, xmlelement, mode);
     56        //XMLPortParam(ScriptController, BaseObject, "lsrc", set_luasrc, xmlelement, mode);
    5557
    5658    }
     
    5860    void ScriptController::moveToPosition(const Vector3& target)
    5961    {
     62       
     63        /*this->controlled_->rotateYaw(-sgn(coord.x)*coord.x*coord.x);
     64        this->controlled_->rotatePitch(sgn(coord.y)*coord.y*coord.y);*/
     65    }
    6066
     67    /*void WaypointController::tick(float dt)  //copied from waypointcontroller
     68    {
     69        if (!this->isActive())
     70            return;
    6171
    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
    6381    /* TO DO
    6482                in the constuctor: make accessible functions such as moveToPosition.. in LUA
    6583            ->tolua++ example: http://usefulgamedev.weebly.com/tolua-example.html*/
     84
     85
    6686
    6787    //function to execute the luafile
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h

    r10025 r10028  
    3030#define _ScriptController_H__
    3131
    32 #include "OrxonoxPrereqs.h"
     32#include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
    3333#include "ArtificialController.h"
    3434#include "core/EventIncludes.h"
    3535
    3636
    37 namespace orxonox
    38 {
    39     class _OrxonoxExport ScriptController : public ArtificialController
    40     {
     37namespace orxonox  // tolua_export
     38{  // tolua_export
     39    class _OrxonoxExport ScriptController // tolua_export
     40       : public ArtificialController
     41    {  // tolua_export
    4142        public:
    42             ScriptController(Context* context, ControllableEntity CE);
     43            //ScriptController(Context* context, ControllableEntity* CE);
     44            ScriptController(Context* context);
     45
    4346            virtual ~ScriptController() { }
    4447
     
    4851            void set_luasrc(std::string);
    4952
    50             void set_controlled(*ControllableEntity);
     53            void set_controlled(ControllableEntity*);
    5154
     55
     56            // LUA interface
     57            // tolua_begin
    5258            void moveToPosition(const Vector3& target);
    5359
    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           
    5761
    5862           
    59                
     63              /* virtual void tick(float dt);*/
    6064
    61             //function to execute the luafile
     65            // tolua_end
    6266
    6367        private:
     
    6771
    6872
    69     };
    70 }
     73    };// tolua_export
     74} // tolua_export
    7175
    7276#endif /* _ScriptController_H__ */
Note: See TracChangeset for help on using the changeset viewer.