Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

renamed scriptable to scriptclass, made ScriptManager create the script triggers

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);
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    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
24 
25    void setCallOnce(bool call) { this->callOnce = call;}
26    void setRadius(float radius) { if(radius>0) this->radius = radius;}
27    void setDelay(float time){if(delay>0) this->delay = delay;}
28    void setScript(std::string& script){this->scriptFile = script;}
29    void setFunction(std::string& function){this->functionName = function;}
30
31    std::string getTargetName();
32
33  private:
34
35    std::string  parentName;
36    WorldEntity* target;
37    bool         worldEntityIsParent;
38    bool         callOnce;
39    bool         scriptCalled;
40    float        radius;
41    float        delay;
42    std::string  scriptFile;
43    std::string  functionName;
44
45    bool callScript;
46    bool triggered;
47    float timer;
48
49};
50
51#endif
Note: See TracBrowser for help on using the repository browser.