[1693] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Benjamin Knecht |
---|
| 24 | * Co-authors: |
---|
[7301] | 25 | * Damian 'Mozork' Frick |
---|
[1693] | 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[7601] | 29 | /** |
---|
| 30 | @file DistanceTrigger.h |
---|
| 31 | @brief Definition of the DistanceTrigger class. |
---|
| 32 | @ingroup NormalTrigger |
---|
| 33 | */ |
---|
| 34 | |
---|
[1693] | 35 | #ifndef _DistanceTrigger_H__ |
---|
| 36 | #define _DistanceTrigger_H__ |
---|
| 37 | |
---|
[5730] | 38 | #include "objects/ObjectsPrereqs.h" |
---|
[1693] | 39 | |
---|
| 40 | #include <set> |
---|
| 41 | #include "core/ClassTreeMask.h" |
---|
[5727] | 42 | #include "Trigger.h" |
---|
| 43 | #include "interfaces/PlayerTrigger.h" |
---|
[1693] | 44 | |
---|
[2071] | 45 | namespace orxonox |
---|
| 46 | { |
---|
[7601] | 47 | |
---|
| 48 | /** |
---|
| 49 | @brief |
---|
| 50 | |
---|
| 51 | @author |
---|
| 52 | Benjamin Knecht |
---|
| 53 | @author |
---|
| 54 | Damian 'Mozork' Frick |
---|
| 55 | |
---|
| 56 | @ingroup NormalTrigger |
---|
| 57 | */ |
---|
[5730] | 58 | class _ObjectsExport DistanceTrigger : public Trigger, public PlayerTrigger |
---|
[1693] | 59 | { |
---|
| 60 | public: |
---|
[2019] | 61 | DistanceTrigger(BaseObject* creator); |
---|
[2071] | 62 | virtual ~DistanceTrigger(); |
---|
[2029] | 63 | |
---|
| 64 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 65 | |
---|
[1693] | 66 | void addTarget(Ogre::Node* targetNode); |
---|
[2029] | 67 | void addTargets(const std::string& targets); |
---|
[1693] | 68 | void removeTarget(Ogre::Node* targetNode); |
---|
[1969] | 69 | void removeTargets(const std::string& targets); |
---|
[2029] | 70 | |
---|
[6906] | 71 | inline void setTargetName(const std::string& targetname) |
---|
[7978] | 72 | { if(targetname != "") this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; } |
---|
[6906] | 73 | inline const std::string& getTargetName(void) |
---|
| 74 | { return this->targetName_; } |
---|
| 75 | |
---|
[2029] | 76 | inline void setDistance(float distance) |
---|
| 77 | { this->distance_ = distance; } |
---|
| 78 | inline float getDistance() const |
---|
| 79 | { return this->distance_; } |
---|
| 80 | |
---|
[1693] | 81 | bool checkDistance(); |
---|
| 82 | |
---|
[1851] | 83 | protected: |
---|
[3280] | 84 | virtual bool isTriggered(TriggerMode::Value mode); |
---|
[3033] | 85 | virtual void notifyMaskUpdate() {} |
---|
[1851] | 86 | |
---|
[3033] | 87 | ClassTreeMask targetMask_; |
---|
| 88 | |
---|
[1693] | 89 | private: |
---|
| 90 | std::set<Ogre::Node*> targetSet_; |
---|
[6906] | 91 | std::string targetName_; |
---|
[1693] | 92 | float distance_; |
---|
[6906] | 93 | bool singleTargetMode_; |
---|
[5727] | 94 | |
---|
[1693] | 95 | }; |
---|
| 96 | } |
---|
| 97 | |
---|
[2071] | 98 | #endif /* _DistanceTrigger_H__ */ |
---|