Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added possibility to set the target as parent

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