Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/script_engine/src/lib/script_engine/script_trigger.h @ 8208

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

added reset function to script manager

File size: 1.3 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
11class ScriptTrigger : public WorldEntity
12{
13  public:
14    ScriptTrigger(const TiXmlElement* root = NULL);
15    ~ScriptTrigger();
16
17    ///LOADING
18    virtual void loadParams(const TiXmlElement* root);
19   
20   
21    /// DO WORK
22    virtual void tick(float timestep);
23    virtual void executeAction();
24
25    /// SET MEMBER
26    void setTarget(const std::string& targetName);
27    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
28    void setTriggerParent(const std::string& name);
29    void setCallOnce(const bool call) { this->callOnce = call; }
30    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
31    void setDelay(const float time){if(delay>0) this->delay = delay; }
32    void setScript(const std::string& script){ this->scriptFile = script; }
33    void setFunction(const std::string& function){ this->functionName = function; }
34
35
36  private:
37
38    WorldEntity* target;
39    bool         callOnce;
40    float        radius;
41    float        delay;
42    std::string  scriptFile;
43    std::string  functionName;
44
45    //for internal use
46    bool         scriptCalled;
47    bool         callScript;
48    bool         triggered;
49    float        timer;
50
51};
52
53#endif
Note: See TracBrowser for help on using the repository browser.