Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

addToScript schould work now

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    Script*      script;
47    std::string  functionName;
48    bool         doDebugDraw;
49   
50   
51    //for internal use
52    bool         executionStopped;   // true when something goes wrong and the trigger had to be stopped
53    int          returnCount;        //TODO: set return count correctly
54   
55  protected:
56   
57    bool         scriptCalled;
58    bool         scriptIsOk;
59    bool         scriptFinished;
60    bool         addToScript;
61
62};
63
64
65#endif
Note: See TracBrowser for help on using the repository browser.