Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10608 in orxonox.OLD for branches/scriptimprovements


Ignore:
Timestamp:
Mar 29, 2007, 5:50:50 PM (18 years ago)
Author:
snellen
Message:

space trigger should work now

Location:
branches/scriptimprovements/src/world_entities/script_triggers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h

    r10607 r10608  
    4141    void setAddToScript(const bool add) { this->addToScript = add; }
    4242    void setTriggerParent(const std::string& name);
     43   
     44    inline void setScriptIsOk(bool ok){ scriptIsOk = ok ; }
     45    inline void setScriptCalled(bool called){ scriptCalled = called; }
     46    inline void setScriptFinished(bool finished){ scriptFinished = finished; }
     47   
     48    ///POLLING
    4349
     50    inline bool getScriptIsOk(){ return scriptIsOk; }
     51    inline bool getScriptCalled(){ return scriptCalled; }
     52    inline bool getScriptFinished(){ return scriptFinished; }
     53   
     54   
    4455    ///DRAWING
    4556    void draw()const{if(doDebugDraw)this->debugDraw();};
  • branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.cc

    r10607 r10608  
    116116void SpaceTrigger::tick(float timestep)
    117117{
     118  if( this->getScriptFinished() ) return;
    118119
     120  if(triggerRemains && this->getScriptCalled() )
     121  {
     122    executeAction(timestep);
     123    return;
     124  }
     125
     126  if( this->target != NULL)
     127  {
     128    if( !invert && this->distance(target) < radius)
     129    {
     130    //printf("Distance is %f \n", this->distance(target));
     131      executeAction(timestep);
     132      this->setScriptCalled(true);
     133      return;
     134
     135    }
     136    else if( invert && this->distance(target) > radius)
     137    {
     138      executeAction(timestep);
     139      this->setScriptCalled(true);
     140      return;
     141    }
     142  }
    119143}
    120144
Note: See TracChangeset for help on using the changeset viewer.