Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Merged inputdevice-branch back to trunk: New ScriptTrigger (ActionTrigger) available

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