Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 31, 2008, 12:56:29 AM (16 years ago)
Author:
landauf
Message:
  • fixed another bug in Trigger
  • added EventTrigger which listens on "trigger" events
Location:
code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers
Files:
2 added
4 edited

Legend:

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

    r2069 r2071  
    3030#include "DistanceTrigger.h"
    3131
     32#include <OgreNode.h>
     33
    3234#include "core/CoreIncludes.h"
    3335#include "core/XMLPort.h"
    3436
    35 namespace orxonox {
    36 
     37namespace orxonox
     38{
    3739  CreateFactory(DistanceTrigger);
    3840
     
    8284    Identifier* targetId = ClassByString(targets);
    8385    if (!targetId)
     86    {
     87        COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
    8488        return;
     89    }
    8590
    8691    this->targetMask_.include(targetId);
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    r2029 r2071  
    3434#include <set>
    3535
    36 #include <OgreNode.h>
    37 
    3836#include "core/ClassTreeMask.h"
    3937#include "core/BaseObject.h"
    4038
    41 namespace orxonox {
    42 
     39namespace orxonox
     40{
    4341  class _OrxonoxExport DistanceTrigger : public Trigger
    4442  {
    4543    public:
    4644      DistanceTrigger(BaseObject* creator);
    47       ~DistanceTrigger();
     45      virtual ~DistanceTrigger();
    4846
    4947      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     
    6260
    6361    protected:
    64       bool isTriggered(TriggerMode mode);
     62      virtual bool isTriggered(TriggerMode mode);
    6563
    6664    private:
     
    6967      float distance_;
    7068  };
    71 
    7269}
    7370
    74 #endif /* _Trigger_H__ */
     71#endif /* _DistanceTrigger_H__ */
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc

    r2069 r2071  
    5858    this->bSwitch_ = false;
    5959    this->bStayActive_ = false;
    60     this->delay_ = 0.0;
     60    this->delay_ = 0.0f;
     61    this->remainingTime_ = 0.0f;
     62    this->timeSinceLastEvent_ = 0.0f;
    6163    this->remainingActivations_ = -1;
    6264
     
    98100      this->fireEvent(false);
    99101    }
     102
     103    // Check if the object is active (this is NOT Trigger::isActive()!)
     104    if (!this->BaseObject::isActive())
     105        return;
    100106
    101107    bool newTriggered = this->isTriggered() ^ this->bInvertMode_;
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.h

    r2069 r2071  
    5252    public:
    5353      Trigger(BaseObject* creator);
    54       ~Trigger();
     54      virtual ~Trigger();
    5555
    5656      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Note: See TracChangeset for help on using the changeset viewer.