Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 7, 2011, 10:19:16 PM (13 years ago)
Author:
dafrick
Message:

Extending DistanceTrigger (both the normal and the MultiTrigger version). DistanceTriggerBeacons, can now also be used to exclude specific objects from triggering a DistanceTrigger.
Beware: The syntax for the DistanceTrigger, used with a DistanceTriggerBeacon has changed.
It was: <DistanceTrigger target="DistanceTriggerBeacon" targetname="someBeacon" />
And is now: <DistanceTrigger target="WhateverTargetYouWantYourTriggerToReactTo" beaconMode="identify" targetname="someBeacon" />
Consult the documentation in DistanceMultiTrigger for it's specific usage, the DistanceTrigger works analogously.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/dockingsystem2/src/modules/objects/triggers/DistanceTrigger.h

    r8079 r8206  
    4545namespace orxonox
    4646{
     47   
     48  /**
     49  @brief
     50      Enum for the beacon mode of the DistanceTrigger.
     51     
     52  @ingroup NormalTrigger
     53  */
     54  namespace distanceTriggerBeaconMode
     55  {
     56      enum Value {
     57          off,
     58          identify,
     59          exclude
     60      };
     61  }
    4762
    4863  /**
     
    6984      void removeTargets(const std::string& targets);
    7085
    71       inline void setTargetName(const std::string& targetname)
    72         { if(targetname != "") this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; }
    73       inline const std::string& getTargetName(void)
    74         { return this->targetName_; }
    75 
    7686      inline void setDistance(float distance)
    7787        { this->distance_ = distance; }
    7888      inline float getDistance() const
    7989        { return this->distance_; }
     90       
     91      void setBeaconModeDirect(distanceTriggerBeaconMode::Value mode); //!< Set the beacon mode.
     92      /**
     93      @brief Get the beacon mode.
     94      @return Returns the mode as an enum.
     95      */
     96      inline distanceTriggerBeaconMode::Value getBeaconModeDirect(void) const
     97        { return this->beaconMode_; }
     98      void setBeaconMode(const std::string& mode); //!< Set the beacon mode.
     99      const std::string& getBeaconMode(void) const; //!< Get the beacon mode.
     100           
     101      inline void setTargetName(const std::string& targetname)
     102        { this->targetName_ = targetname; }
     103      inline const std::string& getTargetName(void)
     104        { return this->targetName_; }
    80105
    81106      bool checkDistance();
     
    88113
    89114    private:
     115      //! Strings for the beacon modes.
     116      static const std::string beaconModeOff_s;
     117      static const std::string beaconModeIdentify_s;
     118      static const std::string beaconModeExlcude_s;
     119           
    90120      std::set<Ogre::Node*> targetSet_;
     121     
     122      distanceTriggerBeaconMode::Value beaconMode_;
    91123      std::string targetName_;
     124      ClassTreeMask* beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
     125     
    92126      float distance_;
    93       bool singleTargetMode_;
    94127
    95128  };
Note: See TracChangeset for help on using the changeset viewer.