source:
orxonox.OLD/trunk/src/world_entities/script_triggers/script_trigger.h
@
10622
Last change on this file since 10622 was 10622, checked in by snellen, 17 years ago | |
---|---|
File size: 1.5 KB |
Rev | Line | |
---|---|---|
[8711] | 1 | /*! |
2 | * @file scrip_trigger.h | |
3 | * triggeres a script | |
4 | */ | |
5 | ||
[8170] | 6 | #ifndef _SCRIPT_TRIGGER_H |
7 | #define _SCRIPT_TRIGGER_H | |
8 | ||
[8171] | 9 | #include <string> |
10 | ||
[8170] | 11 | #include "world_entity.h" |
12 | #include "loading/load_param.h" | |
[8171] | 13 | #include "script_manager.h" |
[8211] | 14 | #include "script.h" |
[8170] | 15 | |
[10614] | 16 | |
[8170] | 17 | class ScriptTrigger : public WorldEntity |
18 | { | |
[9869] | 19 | ObjectListDeclaration(ScriptTrigger); |
[8170] | 20 | public: |
[8207] | 21 | ScriptTrigger(const TiXmlElement* root = NULL); |
[8170] | 22 | ~ScriptTrigger(); |
23 | ||
[8207] | 24 | ///LOADING |
[8170] | 25 | virtual void loadParams(const TiXmlElement* root); |
[8211] | 26 | |
27 | ||
[8208] | 28 | /// DO WORK |
[10614] | 29 | virtual void tick(float timestep) = 0; |
[8711] | 30 | virtual void executeAction(float timestep); |
[8243] | 31 | void testScriptingFramework(); |
[8170] | 32 | |
[8208] | 33 | /// SET MEMBER |
[8211] | 34 | void setScript(const std::string& file); |
[8711] | 35 | void setFunction(const std::string& function){ this->functionName = function;} |
[8408] | 36 | void setDebugDraw(const bool draw) { this->doDebugDraw = draw; } |
[8783] | 37 | void setAddToScript(const bool add) { this->addToScript = add; } |
[10607] | 38 | void setTriggerParent(const std::string& name); |
[10608] | 39 | |
40 | ||
[8262] | 41 | ///DRAWING |
[8408] | 42 | void draw()const{if(doDebugDraw)this->debugDraw();}; |
[8171] | 43 | |
[8170] | 44 | private: |
45 | ||
[8408] | 46 | bool doDebugDraw; |
[10607] | 47 | |
[8208] | 48 | //for internal use |
[10611] | 49 | bool executionStopped; // true when something goes wrong and the trigger had to be stopped |
[10609] | 50 | int returnCount; //TODO: set return count correctly |
51 | ||
52 | protected: | |
[10616] | 53 | Script* script; |
54 | std::string functionName; | |
[8205] | 55 | bool scriptCalled; |
[8211] | 56 | bool scriptIsOk; |
[8894] | 57 | bool scriptFinished; |
[10614] | 58 | bool addToScript; |
[8173] | 59 | |
[8170] | 60 | }; |
61 | ||
[8783] | 62 | |
[8171] | 63 | #endif |
Note: See TracBrowser
for help on using the repository browser.