Rev | Line | |
---|
[8170] | 1 | #ifndef _SCRIPT_TRIGGER_H |
---|
| 2 | #define _SCRIPT_TRIGGER_H |
---|
| 3 | |
---|
[8171] | 4 | #include <string> |
---|
| 5 | |
---|
[8170] | 6 | #include "world_entity.h" |
---|
| 7 | #include "loading/load_param.h" |
---|
[8171] | 8 | #include "vector.h" |
---|
| 9 | #include "script_manager.h" |
---|
[8170] | 10 | |
---|
| 11 | class ScriptTrigger : public WorldEntity |
---|
| 12 | { |
---|
| 13 | public: |
---|
| 14 | ScriptTrigger(); |
---|
| 15 | ~ScriptTrigger(); |
---|
| 16 | |
---|
| 17 | virtual void loadParams(const TiXmlElement* root); |
---|
[8171] | 18 | virtual void tick(float timestep); |
---|
| 19 | virtual void executeAction(); |
---|
[8170] | 20 | |
---|
[8199] | 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; } |
---|
[8193] | 26 | void setCallOnce(bool call) { this->callOnce = call;} |
---|
| 27 | void setRadius(float radius) { if(radius>0) this->radius = radius;} |
---|
[8172] | 28 | void setDelay(float time){if(delay>0) this->delay = delay;} |
---|
[8171] | 29 | void setScript(std::string& script){this->scriptFile = script;} |
---|
| 30 | void setFunction(std::string& function){this->functionName = function;} |
---|
| 31 | |
---|
[8178] | 32 | std::string getTargetName(){return targetName;} |
---|
| 33 | |
---|
[8170] | 34 | private: |
---|
| 35 | |
---|
[8193] | 36 | std::string parentName; |
---|
[8170] | 37 | WorldEntity* target; |
---|
[8178] | 38 | std::string targetName; |
---|
| 39 | bool worldEntityIsParent; |
---|
| 40 | bool callOnce; |
---|
[8170] | 41 | bool scriptCalled; |
---|
| 42 | float radius; |
---|
[8172] | 43 | float delay; |
---|
[8170] | 44 | std::string scriptFile; |
---|
| 45 | std::string functionName; |
---|
| 46 | |
---|
[8173] | 47 | bool callScript; |
---|
| 48 | bool triggered; |
---|
| 49 | float timer; |
---|
| 50 | |
---|
[8170] | 51 | }; |
---|
| 52 | |
---|
[8171] | 53 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.