source:
orxonox.OLD/trunk/src/world_entities/script_trigger.h
@
8643
| Last change on this file since 8643 was 8408, checked in by bensch, 19 years ago | |
|---|---|
| File size: 1.5 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" | |
| [8211] | 10 | #include "script.h" |
| [8170] | 11 | |
| 12 | class ScriptTrigger : public WorldEntity | |
| 13 | { | |
| 14 | public: | |
| [8207] | 15 | ScriptTrigger(const TiXmlElement* root = NULL); |
| [8170] | 16 | ~ScriptTrigger(); |
| 17 | ||
| [8207] | 18 | ///LOADING |
| [8170] | 19 | virtual void loadParams(const TiXmlElement* root); |
| [8211] | 20 | |
| 21 | ||
| [8208] | 22 | /// DO WORK |
| [8171] | 23 | virtual void tick(float timestep); |
| 24 | virtual void executeAction(); | |
| [8243] | 25 | void testScriptingFramework(); |
| [8170] | 26 | |
| [8208] | 27 | /// SET MEMBER |
| [8199] | 28 | void setTarget(const std::string& targetName); |
| [8202] | 29 | void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; } |
| [8205] | 30 | void setTriggerParent(const std::string& name); |
| [8208] | 31 | void setCallOnce(const bool call) { this->callOnce = call; } |
| 32 | void setRadius(const float radius) { if(radius>0) this->radius = radius; } | |
| 33 | void setDelay(const float time){if(delay>0) this->delay = delay; } | |
| [8211] | 34 | void setScript(const std::string& file); |
| [8208] | 35 | void setFunction(const std::string& function){ this->functionName = function; } |
| [8408] | 36 | void setDebugDraw(const bool draw) { this->doDebugDraw = draw; } |
| 37 | ||
| [8262] | 38 | ///DRAWING |
| [8408] | 39 | void draw()const{if(doDebugDraw)this->debugDraw();}; |
| [8171] | 40 | |
| [8170] | 41 | private: |
| 42 | ||
| 43 | WorldEntity* target; | |
| [8178] | 44 | bool callOnce; |
| [8202] | 45 | float radius; |
| 46 | float delay; | |
| [8211] | 47 | Script* script; |
| [8202] | 48 | std::string functionName; |
| [8408] | 49 | bool doDebugDraw; |
| [8170] | 50 | |
| [8208] | 51 | //for internal use |
| [8205] | 52 | bool scriptCalled; |
| [8211] | 53 | bool scriptIsOk; |
| [8173] | 54 | |
| [8170] | 55 | }; |
| 56 | ||
| [8171] | 57 | #endif |
Note: See TracBrowser
for help on using the repository browser.










