Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8783 was 8783, checked in by patrick, 18 years ago

merged the script engine branche back to trunk

File size: 2.0 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 "vector.h"
14#include "script_manager.h"
[8211]15#include "script.h"
[8783]16#include "script_class.h"
[8170]17
18class ScriptTrigger : public WorldEntity
19{
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
[8171]29    virtual void tick(float timestep);
[8711]30    virtual void executeAction(float timestep);
[8243]31    void testScriptingFramework();
[8170]32
[8208]33    /// SET MEMBER
[8199]34    void setTarget(const std::string& targetName);
[8202]35    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
[8205]36    void setTriggerParent(const std::string& name);
[8208]37    void setCallOnce(const bool call) { this->callOnce = call; }
[8711]38    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
39    void setInvert(const bool inv) { this->invert = invert; }
[8208]40    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
41    void setDelay(const float time){if(delay>0) this->delay = delay; }
[8211]42    void setScript(const std::string& file);
[8711]43    void setFunction(const std::string& function){ this->functionName = function;}
[8408]44    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
[8783]45    void setAddToScript(const bool add) { this->addToScript = add; }
[8408]46
[8262]47    ///DRAWING
[8408]48    void draw()const{if(doDebugDraw)this->debugDraw();};
[8171]49
[8170]50  private:
51
52    WorldEntity* target;
[8178]53    bool         callOnce;
[8711]54    bool         triggerLasts;
55    bool         invert;
[8202]56    float        radius;
57    float        delay;
[8211]58    Script*      script;
[8202]59    std::string  functionName;
[8408]60    bool         doDebugDraw;
[8783]61    bool         addToScript;
[8208]62    //for internal use
[8205]63    bool         scriptCalled;
[8211]64    bool         scriptIsOk;
[8711]65    bool         actionFinished;
66    int          returnCount;        //TODO: set return count correctly
[8173]67
[8170]68};
69
[8783]70
[8171]71#endif
Note: See TracBrowser for help on using the repository browser.