Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1550


Ignore:
Timestamp:
Jun 6, 2008, 12:03:56 AM (16 years ago)
Author:
bknecht
Message:

Trigger is now represented by a flare when Debug is on also XML support is enabled (not tested yet though)

Location:
code/branches/script_trigger/src/orxonox/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/script_trigger/src/orxonox/objects/Trigger.cc

    r1541 r1550  
    2929#include "Trigger.h"
    3030
     31#include "core/Debug.h"
     32
    3133#include "core/CoreIncludes.h"
    3234
     
    4042
    4143    targetMask_.exclude(Class(BaseObject));
     44
     45    if (getSoftDebugLevel() >= ORX_DEBUG)
     46    {
     47      debugBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
     48      this->getNode()->attachObject(debugBillboard_.getBillboardSet());
     49    }
    4250  }
    4351
     
    8593  }
    8694
     95  void Trigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     96  {
     97    WorldEntity::XMLPort(xmlelement, mode);
     98  }
     99
    87100  void Trigger::addTrigger(Trigger* trig)
    88101  {
    89102    if (this != trig)
    90       this->triggers_.insert(trig);
     103      this->subTriggers_.insert(trig);
    91104  }
    92105
     
    99112  }
    100113
     114  void Trigger::removeTargets(std::string targets)
     115  {
     116    Identifier* targetId = ID(targets);
     117    targetMask_.exclude(targetId);
     118  }
     119
    101120  bool Trigger::checkAnd()
    102121  {
    103122    std::set<Trigger*>::iterator it;
    104     for(it = this->triggers_.begin(); it != this->triggers_.end(); it++)
     123    for(it = this->subTriggers_.begin(); it != this->subTriggers_.end(); it++)
    105124    {
    106125      if(!((*it)->isTriggered()))
     
    113132  {
    114133    std::set<Trigger*>::iterator it;
    115     for(it = this->triggers_.begin(); it != this->triggers_.end(); it++)
     134    for(it = this->subTriggers_.begin(); it != this->subTriggers_.end(); it++)
    116135    {
    117136      if((*it)->isTriggered())
  • code/branches/script_trigger/src/orxonox/objects/Trigger.h

    r1541 r1550  
    3737#include "core/BaseObject.h"
    3838#include "core/ClassTreeMask.h"
     39#include "../tools/BillboardSet.h"
    3940
    4041namespace orxonox {
     
    5455    public:
    5556      Trigger();
     57      Trigger(bool active) { bActive_ = active; }
    5658      ~Trigger();
    5759
     
    6062      void addTrigger(Trigger* trig);
    6163      void addTargets(std::string targets);
     64      void removeTargets(std::string targets);
     65      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6266      inline TriggerMode getMode() { return mode_; }
    6367      inline void setMode(TriggerMode mode) { this->mode_ = mode; }
    64       inline void tick(float dt) { this->actualTime_ += dt; }
     68      inline void tick(float dt) { if(bActive_) this->actualTime_ += dt; }
     69      inline void reset(float time) { this->actualTime_ = 0; this->triggingTime_ = time; }
     70      inline void reset() { reset(triggingTime_); }
    6571
    6672    private:
     
    7177
    7278    private:
    73       std::set<Trigger*> triggers_;
     79      std::set<Trigger*> subTriggers_;
    7480      TriggerMode mode_;
    7581      float triggingTime_;
    7682      float actualTime_;
    7783      float radius_;
     84      bool bActive_;
    7885      ClassTreeMask targetMask_;
     86      BillboardSet debugBillboard_;
    7987  };
    8088
Note: See TracChangeset for help on using the changeset viewer.