Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Introduced new scripttrigger: space trigger

File size: 1.7 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    ///DRAWING
45    void draw()const{if(doDebugDraw)this->debugDraw();};
46
47  private:
48
49    bool         activeOnCreation;
50    float        delay;
51    Script*      script;
52    std::string  functionName;
53    bool         doDebugDraw;
54    bool         addToScript;
55   
56    //for internal use
57    bool         scriptCalled;
58    bool         scriptIsOk;
59    bool         executionStopped;   // true when something goes wrong and the trigger has to be stopped
60    bool         scriptFinished;
61    int          returnCount;        //TODO: set return count correctly
62
63};
64
65
66#endif
Note: See TracBrowser for help on using the repository browser.