Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/script_triggers/script_trigger.h @ 10765

Last change on this file since 10765 was 10638, checked in by snellen, 18 years ago

Merged inputdevice-branch back to trunk: New ScriptTrigger (ActionTrigger) available

File size: 1.4 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 "script_manager.h"
14#include "script.h"
15
16
17class ScriptTrigger : public WorldEntity
18{
19  ObjectListDeclaration(ScriptTrigger);
20  public:
21    ScriptTrigger(const TiXmlElement* root = NULL);
22    ~ScriptTrigger();
23
24    ///LOADING
25    virtual void loadParams(const TiXmlElement* root);
26
27
28    /// DO WORK
29    virtual void tick(float timestep){}
30    virtual void executeScriptFunction(float timestep);
31
32    /// SET MEMBER
33    void setScript(const std::string& file);
34    void setFunction(const std::string& function){ this->functionName = function;}
35    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
36    void setAddToScript(const bool add) { this->addToScript = add; }
37    void setTriggerParent(const std::string& name);
38   
39   
40    ///DRAWING
41    void draw()const{if(doDebugDraw)this->debugDraw();};
42
43  private:
44
45    bool         doDebugDraw;
46   
47    //for internal use
48    bool         executionStopped;   // true when something goes wrong and the trigger had to be stopped
49    int          returnCount;        //TODO: set return count correctly
50   
51  protected:
52    Script*      script;
53    std::string  functionName;
54    bool         scriptCalled;
55    bool         scriptIsOk;
56    bool         scriptFinished;
57    bool         addToScript;
58
59};
60
61
62#endif
Note: See TracBrowser for help on using the repository browser.