Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2014, 2:32:41 PM (10 years ago)
Author:
smerkli
Message:

Improved controller, "move and look" is now scriptable.

File:
1 edited

Legend:

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

    r10059 r10065  
    4242    {   
    4343        std::string fctName;
    44         float xCoord;
    45         float yCoord;
    46         float zCoord;
     44        float x1;
     45        float y1;
     46        float z1;
     47
     48        float x2;
     49        float y2;
     50        float z2;
     51
     52        float duration;
    4753
    4854        float eventTime;
     
    5460    {  // tolua_export
    5561        public:
    56             //ScriptController(Context* context, ControllableEntity* CE);
    5762            ScriptController(Context* context);
    5863
    5964            virtual ~ScriptController() { }
    6065
    61             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     66            //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6267           
    6368            void takeControl(int ctrlid);
    6469            void setPlayer(PlayerInfo* player) { this->player_ = player; }
    6570           
    66            
    67 
    68             //void set_luasrc(std::string);
    69             //void set_controlled(ControllableEntity*);
    70 
    7171            virtual void tick(float dt);
    7272
    7373            // LUA interface
    7474            // tolua_begin
    75             void moveToPosition_beta(float x, float y, float z);
     75            void moveAndLook(float xm, float ym, float zm,
     76              float xl, float yl, float zl, float t);
    7677
    77             void eventScheduler(std::string instruction, float x, float y, float z, float time);
     78            void eventScheduler(std::string instruction,
     79              float x1, float y1, float z1,
     80              float x2, float y2, float z2,
     81              float duration, float executionTime);
    7882
    7983            static ScriptController* getScriptController();
    8084
    8185            int getID() { return ctrlid_; }
    82            
    8386
    8487            // tolua_end
     
    8891
    8992        private:
    90             // name of the LUA-sourcefile that shall be executed->see XMLPort-function
    91             std::string luasrc;         
     93            /* Information about the player that this ScriptController will
     94             * control */
     95            /* - Player pointer */
    9296            PlayerInfo* player_;
     97
     98            /* - Entity pointer, this is for convenience and will be the same as
     99             *   player_->getControllableEntity()
     100             */
    93101            ControllableEntity* entity_;
     102
     103            /* Controller ID, defaults to 0 and is set using takeControl() */
    94104            int ctrlid_;
    95105
     106            /* List of events to walk through */
     107            std::vector<event> eventList;
     108            unsigned int eventno;
     109
     110            /* Time since the creation of this ScriptController object */
     111            float scTime; 
     112
     113            /* Boolean that specifies whether we're processing an event right
     114             * now */
     115            bool processing;
     116
     117            /* Data about the point to go to and what to look at */
     118            /* - Target position */
     119            Vector3 target;
     120
     121            /* - Time it should take to get there */
     122            float timeToTarget;
     123
     124            /* - Time this event has been going on for */
     125            float eventTime;
     126            Vector3 startpos;
     127
     128            /* - Position to look at during that transition */
     129            Vector3 lookAtPosition;
    96130
    97131    };// tolua_export
Note: See TracChangeset for help on using the changeset viewer.