Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h @ 10608

Last change on this file since 10608 was 10608, checked in by snellen, 17 years ago

space trigger should work now

File size: 2.1 KB
Line 
1/*!
2 * @file scrip_trigger.h
3 *  triggeres a script
4 */
5
6#ifndef _SCRIPT_TRIGGER_H
7#define _SCRIPT_TRIGGER_H
8
9#include <string>
10
11#include "world_entity.h"
12#include "loading/load_param.h"
13#include "vector.h"
14#include "script_manager.h"
15#include "script.h"
16#include "script_class.h"
17
18class ScriptTrigger : public WorldEntity
19{
20  ObjectListDeclaration(ScriptTrigger);
21  public:
22    ScriptTrigger(const TiXmlElement* root = NULL);
23    ~ScriptTrigger();
24
25    ///LOADING
26    virtual void loadParams(const TiXmlElement* root);
27
28
29    /// DO WORK
30    virtual void tick(float timestep);
31    virtual void executeAction(float timestep);
32    void testScriptingFramework();
33
34    /// SET MEMBER
35 
36    void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; }
37    void setDelay(float delay) { this->delay = delay; };
38    void setScript(const std::string& file);
39    void setFunction(const std::string& function){ this->functionName = function;}
40    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
41    void setAddToScript(const bool add) { this->addToScript = add; }
42    void setTriggerParent(const std::string& name);
43   
44    inline void setScriptIsOk(bool ok){ scriptIsOk = ok ; }
45    inline void setScriptCalled(bool called){ scriptCalled = called; }
46    inline void setScriptFinished(bool finished){ scriptFinished = finished; }
47   
48    ///POLLING
49
50    inline bool getScriptIsOk(){ return scriptIsOk; }
51    inline bool getScriptCalled(){ return scriptCalled; }
52    inline bool getScriptFinished(){ return scriptFinished; }
53   
54   
55    ///DRAWING
56    void draw()const{if(doDebugDraw)this->debugDraw();};
57
58  private:
59
60    bool         activeOnCreation;
61    float        delay;
62    Script*      script;
63    std::string  functionName;
64    bool         doDebugDraw;
65    bool         addToScript;
66   
67    //for internal use
68    bool         scriptCalled;
69    bool         scriptIsOk;
70    bool         executionStopped;   // true when something goes wrong and the trigger has to be stopped
71    bool         scriptFinished;
72    int          returnCount;        //TODO: set return count correctly
73
74};
75
76
77#endif
Note: See TracBrowser for help on using the repository browser.