source:
orxonox.OLD/branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h
@
10607
Last change on this file since 10607 was 10607, checked in by snellen, 17 years ago | |
---|---|
File size: 1.7 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 "vector.h" |
14 | #include "script_manager.h" | |
[8211] | 15 | #include "script.h" |
[8783] | 16 | #include "script_class.h" |
[8170] | 17 | |
18 | class ScriptTrigger : public WorldEntity | |
19 | { | |
[9869] | 20 | ObjectListDeclaration(ScriptTrigger); |
[8170] | 21 | public: |
[8207] | 22 | ScriptTrigger(const TiXmlElement* root = NULL); |
[8170] | 23 | ~ScriptTrigger(); |
24 | ||
[8207] | 25 | ///LOADING |
[8170] | 26 | virtual void loadParams(const TiXmlElement* root); |
[8211] | 27 | |
28 | ||
[8208] | 29 | /// DO WORK |
[8171] | 30 | virtual void tick(float timestep); |
[8711] | 31 | virtual void executeAction(float timestep); |
[8243] | 32 | void testScriptingFramework(); |
[8170] | 33 | |
[8208] | 34 | /// SET MEMBER |
[10607] | 35 | |
[9298] | 36 | void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; } |
[9006] | 37 | void setDelay(float delay) { this->delay = delay; }; |
[8211] | 38 | void setScript(const std::string& file); |
[8711] | 39 | void setFunction(const std::string& function){ this->functionName = function;} |
[8408] | 40 | void setDebugDraw(const bool draw) { this->doDebugDraw = draw; } |
[8783] | 41 | void setAddToScript(const bool add) { this->addToScript = add; } |
[10607] | 42 | void setTriggerParent(const std::string& name); |
[8408] | 43 | |
[8262] | 44 | ///DRAWING |
[8408] | 45 | void draw()const{if(doDebugDraw)this->debugDraw();}; |
[8171] | 46 | |
[8170] | 47 | private: |
48 | ||
[9298] | 49 | bool activeOnCreation; |
[8202] | 50 | float delay; |
[8211] | 51 | Script* script; |
[8202] | 52 | std::string functionName; |
[8408] | 53 | bool doDebugDraw; |
[8783] | 54 | bool addToScript; |
[10607] | 55 | |
[8208] | 56 | //for internal use |
[8205] | 57 | bool scriptCalled; |
[8211] | 58 | bool scriptIsOk; |
[10565] | 59 | bool executionStopped; // true when something goes wrong and the trigger has to be stopped |
[8894] | 60 | bool scriptFinished; |
[8711] | 61 | int returnCount; //TODO: set return count correctly |
[8173] | 62 | |
[8170] | 63 | }; |
64 | ||
[8783] | 65 | |
[8171] | 66 | #endif |
Note: See TracBrowser
for help on using the repository browser.