Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8304 in orxonox.OLD


Ignore:
Timestamp:
Jun 10, 2006, 8:51:17 AM (18 years ago)
Author:
snellen
Message:

script_trigger: added possibility to set debug draw in the xml file

Location:
branches/script_engine/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/world_entities/script_trigger.cc

    r8289 r8304  
    66
    77#include "state.h"
    8  
    9  
    10  
     8
     9
     10
    1111ScriptTrigger::ScriptTrigger(const TiXmlElement* root)
    1212{
    1313  this->setClassID(CL_SCRIPT_TRIGGER, "ScriptTrigger");
    1414  this->toList(OM_COMMON);
    15  
     15
     16  debugDraw = false;
    1617  scriptCalled = false;
    1718  scriptIsOk = false;
     
    5556        .describe("True if the script shoul only be called once")
    5657        .defaultValues("");
     58    LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
     59        .describe("True if the script shoul only be called once")
     60        .defaultValues("");
    5761  }
    5862
     
    9195void ScriptTrigger::tick(float timestep)
    9296{
    93  
     97
    9498  if( this->distance(target) < radius)
    9599 {
     
    125129void ScriptTrigger::setScript(const std::string& file)
    126130{
    127  
     131
    128132  ScriptManager* scriptManager = State::getScriptManager();
    129133  if (scriptManager != NULL)
    130134  {
    131    
     135
    132136    script = scriptManager->getScriptByFile(file);
    133137    if(script != NULL)
  • branches/script_engine/src/world_entities/script_trigger.h

    r8271 r8304  
    3434    void setScript(const std::string& file);
    3535    void setFunction(const std::string& function){ this->functionName = function; }
    36    
     36    void setDebugDraw(const bool draw) { this->debugDraw = draw; }
     37
    3738    ///DRAWING
    38     void draw()const{this->debugDraw();};
     39    void draw()const{if(debugDraw)this->debugDraw();};
    3940
    4041  private:
     
    4647    Script*      script;
    4748    std::string  functionName;
     49    bool         debugDraw;
    4850
    4951    //for internal use
Note: See TracChangeset for help on using the changeset viewer.