Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h @ 10611

Last change on this file since 10611 was 10611, checked in by snellen, 17 years ago

Triggers can now be creater from the xml file… again

File size: 1.5 KB
Line 
1/*!
2 * @file scrip_trigger.h
3 *  triggeres a script
4 */
5
6#ifndef _SCRIPT_TRIGGER_H
7#define _SCRIPT_TRIGGER_H
8
9#include <string>
10
11#include "world_entity.h"
12#include "loading/load_param.h"
13#include "vector.h"
14#include "script_manager.h"
15#include "script.h"
16#include "script_class.h"
17
18class ScriptTrigger : public WorldEntity
19{
20  ObjectListDeclaration(ScriptTrigger);
21  public:
22    ScriptTrigger(const TiXmlElement* root = NULL);
23    ~ScriptTrigger();
24
25    ///LOADING
26    virtual void loadParams(const TiXmlElement* root);
27
28
29    /// DO WORK
30    virtual void tick(float timestep){}
31    virtual void executeAction(float timestep);
32    void testScriptingFramework();
33
34    /// SET MEMBER
35    void setScript(const std::string& file);
36    void setFunction(const std::string& function){ this->functionName = function;}
37    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
38    void setAddToScript(const bool add) { this->addToScript = add; }
39    void setTriggerParent(const std::string& name);
40   
41   
42    ///DRAWING
43    void draw()const{if(doDebugDraw)this->debugDraw();};
44
45  private:
46
47    Script*      script;
48    std::string  functionName;
49    bool         doDebugDraw;
50    bool         addToScript;
51   
52    //for internal use
53    bool         executionStopped;   // true when something goes wrong and the trigger had to be stopped
54    int          returnCount;        //TODO: set return count correctly
55   
56  protected:
57   
58    bool         scriptCalled;
59    bool         scriptIsOk;
60    bool         scriptFinished;
61
62};
63
64
65#endif
Note: See TracBrowser for help on using the repository browser.