Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8714 was 8711, checked in by bensch, 19 years ago

merged the script_engine back here

File size: 1.8 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"
[8170]16
17class ScriptTrigger : public WorldEntity
18{
19  public:
[8207]20    ScriptTrigger(const TiXmlElement* root = NULL);
[8170]21    ~ScriptTrigger();
22
[8207]23    ///LOADING
[8170]24    virtual void loadParams(const TiXmlElement* root);
[8211]25
26
[8208]27    /// DO WORK
[8171]28    virtual void tick(float timestep);
[8711]29    virtual void executeAction(float timestep);
[8243]30    void testScriptingFramework();
[8170]31
[8208]32    /// SET MEMBER
[8199]33    void setTarget(const std::string& targetName);
[8202]34    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
[8205]35    void setTriggerParent(const std::string& name);
[8208]36    void setCallOnce(const bool call) { this->callOnce = call; }
[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; }
44
[8262]45    ///DRAWING
[8408]46    void draw()const{if(doDebugDraw)this->debugDraw();};
[8171]47
[8170]48  private:
49
50    WorldEntity* target;
[8178]51    bool         callOnce;
[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;
[8170]59
[8208]60    //for internal use
[8205]61    bool         scriptCalled;
[8211]62    bool         scriptIsOk;
[8711]63    bool         actionFinished;
64    int          returnCount;        //TODO: set return count correctly
[8173]65
[8170]66};
67
[8171]68#endif
Note: See TracBrowser for help on using the repository browser.