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
|
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: |
---|
[8207] | 14 | ScriptTrigger(const TiXmlElement* root = NULL); |
---|
[8170] | 15 | ~ScriptTrigger(); |
---|
| 16 | |
---|
[8207] | 17 | ///LOADING |
---|
[8170] | 18 | virtual void loadParams(const TiXmlElement* root); |
---|
[8207] | 19 | |
---|
| 20 | |
---|
[8208] | 21 | /// DO WORK |
---|
[8171] | 22 | virtual void tick(float timestep); |
---|
| 23 | virtual void executeAction(); |
---|
[8170] | 24 | |
---|
[8208] | 25 | /// SET MEMBER |
---|
[8199] | 26 | void setTarget(const std::string& targetName); |
---|
[8202] | 27 | void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; } |
---|
[8205] | 28 | void setTriggerParent(const std::string& name); |
---|
[8208] | 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; } |
---|
[8171] | 34 | |
---|
[8208] | 35 | |
---|
[8170] | 36 | private: |
---|
| 37 | |
---|
| 38 | WorldEntity* target; |
---|
[8178] | 39 | bool callOnce; |
---|
[8202] | 40 | float radius; |
---|
| 41 | float delay; |
---|
| 42 | std::string scriptFile; |
---|
| 43 | std::string functionName; |
---|
[8170] | 44 | |
---|
[8208] | 45 | //for internal use |
---|
[8205] | 46 | bool scriptCalled; |
---|
| 47 | bool callScript; |
---|
| 48 | bool triggered; |
---|
| 49 | float timer; |
---|
[8173] | 50 | |
---|
[8170] | 51 | }; |
---|
| 52 | |
---|
[8171] | 53 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.