| Rev | Line |   | 
|---|
| [10620] | 1 | /*! | 
|---|
 | 2 |  * @file time_trigger.h | 
|---|
 | 3 |  *  triggers a script after a given time | 
|---|
 | 4 |  */ | 
|---|
 | 5 |  | 
|---|
 | 6 | #ifndef _TIME_TRIGGER_H | 
|---|
 | 7 | #define _TIME_TRIGGER_H | 
|---|
 | 8 |  | 
|---|
 | 9 | #include <string> | 
|---|
 | 10 |  | 
|---|
 | 11 | #include "script.h" | 
|---|
 | 12 | #include "script_trigger.h" | 
|---|
 | 13 |  | 
|---|
 | 14 | class TimeTrigger : public ScriptTrigger | 
|---|
 | 15 | { | 
|---|
 | 16 |   ObjectListDeclaration(TimeTrigger); | 
|---|
 | 17 |    | 
|---|
 | 18 |   public: | 
|---|
 | 19 |     TimeTrigger(const TiXmlElement* root = NULL); | 
|---|
 | 20 |     ~TimeTrigger(); | 
|---|
 | 21 |      | 
|---|
| [10621] | 22 |     ///LOADING | 
|---|
 | 23 |     virtual void loadParams(const TiXmlElement* root); | 
|---|
 | 24 |      | 
|---|
| [10620] | 25 |     void setDelay(float newDelay){this->currentTime = this->delay = newDelay;} | 
|---|
 | 26 |     void start(){ this->isStopped = false; } | 
|---|
 | 27 |     void stop(){ this->isStopped = true; } | 
|---|
 | 28 |     void reset(){ this->currentTime = delay; } | 
|---|
 | 29 |  | 
|---|
 | 30 |     /// DO WORK | 
|---|
 | 31 |     virtual void tick(float timestep); | 
|---|
 | 32 |    | 
|---|
 | 33 |   private: | 
|---|
 | 34 |     float delay; | 
|---|
 | 35 |     float currentTime; | 
|---|
 | 36 |     bool  isStopped; | 
|---|
 | 37 |  | 
|---|
 | 38 | }; | 
|---|
 | 39 |  | 
|---|
 | 40 | #endif | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.