Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

merged the branche single_player_map with the trunk

File size: 1.9 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);
[8711]37    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
38    void setInvert(const bool inv) { this->invert = invert; }
[8208]39    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
40    void setDelay(const float time){if(delay>0) this->delay = delay; }
[8211]41    void setScript(const std::string& file);
[8711]42    void setFunction(const std::string& function){ this->functionName = function;}
[8408]43    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
[8783]44    void setAddToScript(const bool add) { this->addToScript = add; }
[8408]45
[8262]46    ///DRAWING
[8408]47    void draw()const{if(doDebugDraw)this->debugDraw();};
[8171]48
[8170]49  private:
50
51    WorldEntity* target;
[8711]52    bool         triggerLasts;
53    bool         invert;
[8202]54    float        radius;
55    float        delay;
[8211]56    Script*      script;
[8202]57    std::string  functionName;
[8408]58    bool         doDebugDraw;
[8783]59    bool         addToScript;
[8208]60    //for internal use
[8205]61    bool         scriptCalled;
[8211]62    bool         scriptIsOk;
[8894]63    bool         scriptFinished;
[8711]64    int          returnCount;        //TODO: set return count correctly
[8173]65
[8170]66};
67
[8783]68
[8171]69#endif
Note: See TracBrowser for help on using the repository browser.