Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8776 was 8711, checked in by bensch, 18 years ago

merged the script_engine back here

File size: 1.8 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
17class ScriptTrigger : public WorldEntity
18{
19  public:
20    ScriptTrigger(const TiXmlElement* root = NULL);
21    ~ScriptTrigger();
22
23    ///LOADING
24    virtual void loadParams(const TiXmlElement* root);
25
26
27    /// DO WORK
28    virtual void tick(float timestep);
29    virtual void executeAction(float timestep);
30    void testScriptingFramework();
31
32    /// SET MEMBER
33    void setTarget(const std::string& targetName);
34    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
35    void setTriggerParent(const std::string& name);
36    void setCallOnce(const bool call) { this->callOnce = call; }
37    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
38    void setInvert(const bool inv) { this->invert = invert; }
39    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
40    void setDelay(const float time){if(delay>0) this->delay = delay; }
41    void setScript(const std::string& file);
42    void setFunction(const std::string& function){ this->functionName = function;}
43    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
44
45    ///DRAWING
46    void draw()const{if(doDebugDraw)this->debugDraw();};
47
48  private:
49
50    WorldEntity* target;
51    bool         callOnce;
52    bool         triggerLasts;
53    bool         invert;
54    float        radius;
55    float        delay;
56    Script*      script;
57    std::string  functionName;
58    bool         doDebugDraw;
59
60    //for internal use
61    bool         scriptCalled;
62    bool         scriptIsOk;
63    bool         actionFinished;
64    int          returnCount;        //TODO: set return count correctly
65
66};
67
68#endif
Note: See TracBrowser for help on using the repository browser.