Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/script_engine/src/world_entities/script_trigger.h @ 8675

Last change on this file since 8675 was 8485, checked in by snellen, 18 years ago

helicopter scripted

File size: 1.7 KB
Line 
1#ifndef _SCRIPT_TRIGGER_H
2#define _SCRIPT_TRIGGER_H
3
4#include <string>
5
6#include "world_entity.h"
7#include "loading/load_param.h"
8#include "vector.h"
9#include "script_manager.h"
10#include "script.h"
11
12class ScriptTrigger : public WorldEntity
13{
14  public:
15    ScriptTrigger(const TiXmlElement* root = NULL);
16    ~ScriptTrigger();
17
18    ///LOADING
19    virtual void loadParams(const TiXmlElement* root);
20
21
22    /// DO WORK
23    virtual void tick(float timestep);
24    virtual void executeAction(float timestep);
25    void testScriptingFramework();
26
27    /// SET MEMBER
28    void setTarget(const std::string& targetName);
29    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
30    void setTriggerParent(const std::string& name);
31    void setCallOnce(const bool call) { this->callOnce = call; }
32    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
33    void setInvert(const bool inv) { this->invert = invert; }
34    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
35    void setDelay(const float time){if(delay>0) this->delay = delay; }
36    void setScript(const std::string& file);
37    void setFunction(const std::string& function){ this->functionName = function;}
38    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
39
40    ///DRAWING
41    void draw()const{if(doDebugDraw)this->debugDraw();};
42
43  private:
44
45    WorldEntity* target;
46    bool         callOnce;
47    bool         triggerLasts;
48    bool         invert;
49    float        radius;
50    float        delay;
51    Script*      script;
52    std::string  functionName;
53    bool         doDebugDraw;
54
55    //for internal use
56    bool         scriptCalled;
57    bool         scriptIsOk;
58    bool         actionFinished;
59    int          returnCount;
60
61};
62
63#endif
Note: See TracBrowser for help on using the repository browser.