Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/script_triggers/script_trigger.h @ 10633

Last change on this file since 10633 was 10622, checked in by snellen, 18 years ago

merged scriptimprovements back to trunk

File size: 1.5 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 "script_manager.h"
14#include "script.h"
15
16
17class ScriptTrigger : public WorldEntity
18{
19  ObjectListDeclaration(ScriptTrigger);
20  public:
21    ScriptTrigger(const TiXmlElement* root = NULL);
22    ~ScriptTrigger();
23
24    ///LOADING
25    virtual void loadParams(const TiXmlElement* root);
26
27
28    /// DO WORK
29    virtual void tick(float timestep) = 0;
30    virtual void executeAction(float timestep);
31    void testScriptingFramework();
32
33    /// SET MEMBER
34    void setScript(const std::string& file);
35    void setFunction(const std::string& function){ this->functionName = function;}
36    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
37    void setAddToScript(const bool add) { this->addToScript = add; }
38    void setTriggerParent(const std::string& name);
39   
40   
41    ///DRAWING
42    void draw()const{if(doDebugDraw)this->debugDraw();};
43
44  private:
45
46    bool         doDebugDraw;
47   
48    //for internal use
49    bool         executionStopped;   // true when something goes wrong and the trigger had to be stopped
50    int          returnCount;        //TODO: set return count correctly
51   
52  protected:
53    Script*      script;
54    std::string  functionName;
55    bool         scriptCalled;
56    bool         scriptIsOk;
57    bool         scriptFinished;
58    bool         addToScript;
59
60};
61
62
63#endif
Note: See TracBrowser for help on using the repository browser.