Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/controllers/ScriptController.h @ 10426

Last change on this file since 10426 was 10262, checked in by landauf, 10 years ago

eol-style native. no changes in code.

  • Property svn:eol-style set to native
File size: 3.6 KB
RevLine 
[10014]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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _ScriptController_H__
30#define _ScriptController_H__
31
[10028]32#include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
[10014]33#include "ArtificialController.h"
34#include "core/EventIncludes.h"
35
36
[10048]37
[10028]38namespace orxonox  // tolua_export
39{  // tolua_export
[10048]40
[10066]41    /** Structure to describe a single event */
[10048]42    struct event
43    {   
[10066]44        /** Instruction for this event */
[10048]45        std::string fctName;
46
[10066]47        Vector3 v1;
48        Vector3 v2;
[10065]49
[10066]50        /** Time span of the event */
[10065]51        float duration;
52
[10066]53        /** Start point in time of the event */
[10048]54        float eventTime;
55    }; 
56
[10028]57    class _OrxonoxExport ScriptController // tolua_export
[10047]58       : public ArtificialController, public Tickable
[10028]59    {  // tolua_export
[10014]60        public:
[10028]61            ScriptController(Context* context);
[10014]62            virtual ~ScriptController() { }
63
[10047]64            void takeControl(int ctrlid);
65            void setPlayer(PlayerInfo* player) { this->player_ = player; }
[10020]66           
[10047]67            virtual void tick(float dt);
[10028]68
69            // LUA interface
70            // tolua_begin
[10065]71            void eventScheduler(std::string instruction, 
72              float x1, float y1, float z1, 
73              float x2, float y2, float z2, 
74              float duration, float executionTime);
[10048]75
[10045]76            static ScriptController* getScriptController();
[10047]77
78            int getID() { return ctrlid_; }
[10020]79
[10028]80            // tolua_end
[10045]81            const Vector3& getPosition();
[10020]82
[10048]83            void execute(event ev);
84
[10014]85        private:
[10065]86            /* Information about the player that this ScriptController will
87             * control */
88            /* - Player pointer */
[10047]89            PlayerInfo* player_;
[10065]90
91            /* - Entity pointer, this is for convenience and will be the same as
92             *   player_->getControllableEntity()
93             */
[10047]94            ControllableEntity* entity_;
[10065]95
96            /* Controller ID, defaults to 0 and is set using takeControl() */
[10047]97            int ctrlid_;
[10014]98
[10065]99            /* List of events to walk through */
100            std::vector<event> eventList;
101            unsigned int eventno;
[10014]102
[10065]103            /* Time since the creation of this ScriptController object */
104            float scTime; 
105
106            /* Boolean that specifies whether we're processing an event right
107             * now */
108            bool processing;
109
[10066]110            /* Data about the event currently being processed */
111            /* - The event itself */
112            event currentEvent;
[10065]113
114            /* - Time this event has been going on for */
115            float eventTime;
116            Vector3 startpos;
117
118            /* - Position to look at during that transition */
[10066]119            //Vector3 lookAtPosition;
[10065]120
[10028]121    };// tolua_export
122} // tolua_export
[10014]123
124#endif /* _ScriptController_H__ */
Note: See TracBrowser for help on using the repository browser.