Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/scriptimprovements/src/world_entities/script_trigger.h @ 10565

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

script_trigger: added conclsive errormessage in case of abort

File size: 2.1 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{
[9869]20  ObjectListDeclaration(ScriptTrigger);
[8170]21  public:
[8207]22    ScriptTrigger(const TiXmlElement* root = NULL);
[8170]23    ~ScriptTrigger();
24
[8207]25    ///LOADING
[8170]26    virtual void loadParams(const TiXmlElement* root);
[8211]27
28
[8208]29    /// DO WORK
[8171]30    virtual void tick(float timestep);
[8711]31    virtual void executeAction(float timestep);
[8243]32    void testScriptingFramework();
[8170]33
[8208]34    /// SET MEMBER
[8199]35    void setTarget(const std::string& targetName);
[8202]36    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
[8205]37    void setTriggerParent(const std::string& name);
[9298]38    void setTriggerRemains(const bool lasts) { this->triggerRemains = lasts; }
39    void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; }
[8711]40    void setInvert(const bool inv) { this->invert = invert; }
[9006]41    void setDelay(float delay) { this->delay = delay; };
[8208]42    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
[8211]43    void setScript(const std::string& file);
[8711]44    void setFunction(const std::string& function){ this->functionName = function;}
[8408]45    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
[8783]46    void setAddToScript(const bool add) { this->addToScript = add; }
[8408]47
[8262]48    ///DRAWING
[8408]49    void draw()const{if(doDebugDraw)this->debugDraw();};
[8171]50
[8170]51  private:
52
53    WorldEntity* target;
[9298]54    bool         triggerRemains;
55    bool         activeOnCreation;
[8711]56    bool         invert;
[8202]57    float        radius;
58    float        delay;
[8211]59    Script*      script;
[8202]60    std::string  functionName;
[8408]61    bool         doDebugDraw;
[8783]62    bool         addToScript;
[8208]63    //for internal use
[8205]64    bool         scriptCalled;
[8211]65    bool         scriptIsOk;
[10565]66    bool         executionStopped;   // true when something goes wrong and the trigger has to be stopped
[8894]67    bool         scriptFinished;
[8711]68    int          returnCount;        //TODO: set return count correctly
[8173]69
[8170]70};
71
[8783]72
[8171]73#endif
Note: See TracBrowser for help on using the repository browser.