Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

setTarget should work

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