Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cleanup/src/world_entities/tools/script_trigger.h @ 10591

Last change on this file since 10591 was 10591, checked in by bensch, 17 years ago

moved the we's to a more senseable location.

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{
[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);
[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);
[9298]37    void setTriggerRemains(const bool lasts) { this->triggerRemains = lasts; }
38    void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; }
[8711]39    void setInvert(const bool inv) { this->invert = invert; }
[9006]40    void setDelay(float delay) { this->delay = delay; };
[8208]41    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
[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;
[9298]53    bool         triggerRemains;
54    bool         activeOnCreation;
[8711]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;
[8894]65    bool         scriptFinished;
[8711]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.