Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1969


Ignore:
Timestamp:
Oct 20, 2008, 2:08:04 AM (16 years ago)
Author:
landauf
Message:

some small adjustments in Trigger (console command and xmlport)

Location:
code/branches/objecthierarchy/src/orxonox/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/DistanceTrigger.cc

    r1961 r1969  
    6969  }
    7070
    71   void DistanceTrigger::addTargets(std::string targets)
     71  void DistanceTrigger::addTargets(const std::string& targets)
    7272  {
    7373    Identifier* targetId = ClassByString(targets);
     
    7878  }
    7979
    80   void DistanceTrigger::removeTargets(std::string targets)
     80  void DistanceTrigger::removeTargets(const std::string& targets)
    8181  {
    8282    Identifier* targetId = ClassByString(targets);
  • code/branches/objecthierarchy/src/orxonox/objects/DistanceTrigger.h

    r1959 r1969  
    4848      void addTarget(Ogre::Node* targetNode);
    4949      void removeTarget(Ogre::Node* targetNode);
    50       void addTargets(std::string targets);
    51       void removeTargets(std::string targets);
     50      void addTargets(const std::string& targets);
     51      void removeTargets(const std::string& targets);
    5252      void setDistance(float dist);
    5353      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
  • code/branches/objecthierarchy/src/orxonox/objects/Trigger.cc

    r1962 r1969  
    3939{
    4040
    41   SetConsoleCommand(Trigger, setVisibility, false).accessLevel(AccessLevel::User).defaultValues(0);
     41  SetConsoleCommand(Trigger, debugFlares, false).defaultValues(false);
    4242
    4343  CreateFactory(Trigger);
     
    5858
    5959    debugBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
     60    debugBillboard_.setVisible(false);
     61
    6062    this->getNode()->attachObject(debugBillboard_.getBillboardSet());
    6163  }
     
    6769  void Trigger::init()
    6870  {
    69     this->setVisibility(true);
    7071    timeSinceLastEvent_ = delay_;
    7172  }
    7273
    73   void Trigger::setVisibility(bool bVisible)
    74   {
    75     if(bVisible)
    76       this->setScale(2);
    77     else
    78       this->setScale(0);
     74  void Trigger::debugFlares(bool bVisible)
     75  {
     76    for (ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)
     77      it->setVisible(bVisible);
     78  }
     79
     80  void Trigger::changedVisibility()
     81  {
     82    debugBillboard_.setVisible(this->isVisible());
    7983  }
    8084
     
    206210  }
    207211
    208   void Trigger::setMode(std::string modeName)
     212  void Trigger::setMode(const std::string& modeName)
    209213  {
    210214    if (modeName == "and")
     
    224228    XMLPortParamLoadOnly(Trigger, "activations", setActivations, xmlelement, mode);
    225229    XMLPortParamLoadOnly(Trigger, "invert", setInvert, xmlelement, mode);
    226     //XMLPortParamLoadOnlyTemplate(Trigger, "mode", setMode, xmlelement, mode, std::string);
     230    XMLPortParamLoadOnlyTemplate(Trigger, "mode", setMode, xmlelement, mode, const std::string&);
    227231
    228232    XMLPortObject(Trigger, Trigger, "", addTrigger, getTrigger, xmlelement, mode);
  • code/branches/objecthierarchy/src/orxonox/objects/Trigger.h

    r1961 r1969  
    5454      ~Trigger();
    5555
    56       inline bool isActive() { return bActive_; }
     56      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     57      virtual void tick(float dt);
     58
     59      inline bool isActive() const
     60        { return bActive_; }
     61
    5762      void addTrigger(Trigger* trig);
    58       void setInvert(int invert) { bInvertMode_ = invert; }
    5963      const Trigger* getTrigger(unsigned int index) const;
    60       void setVisibility(bool bVisible);
     64
     65      inline TriggerMode getMode() const
     66        { return mode_; }
     67      inline void setMode(TriggerMode mode)
     68        { this->mode_ = mode; }
     69      void setMode(const std::string& modeName);
     70
     71      inline void setInvert(int invert)
     72        { bInvertMode_ = invert; }
     73      inline void setStayOn(int stayOn)
     74        { this->bStayOn_ = (stayOn == 1) ? true : false; }
     75      inline void setActivations(int activations)
     76        { this->remainingActivations_ = activations; }
    6177      void setDelay(float delay);
    6278      bool switchState();
    63       virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    64       inline TriggerMode getMode() { return mode_; }
    65       inline void setMode(TriggerMode mode) { this->mode_ = mode; }
    66       void setMode(std::string modeName);
    67       inline void setStayOn(int stayOn) { if (stayOn == 1) this->bStayOn_ = true; else this->bStayOn_ = false; }
    68       inline void setActivations(int activations) { this->remainingActivations_ = activations; }
    69       void tick(float dt);
     79
     80      static void debugFlares(bool bVisible);
     81      virtual void changedVisibility();
    7082
    7183    private:
Note: See TracChangeset for help on using the changeset viewer.