[2194] | 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 | * Damian 'Mozork' Frick |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
[2221] | 28 | |
---|
| 29 | /** |
---|
[2662] | 30 | @file |
---|
[2221] | 31 | @brief |
---|
[2662] | 32 | Definition of the PlayerTrigger class. |
---|
[2221] | 33 | */ |
---|
| 34 | |
---|
[2194] | 35 | #ifndef _PlayerTrigger_H__ |
---|
| 36 | #define _PlayerTrigger_H__ |
---|
| 37 | |
---|
[2221] | 38 | #include "OrxonoxPrereqs.h" |
---|
| 39 | |
---|
[2194] | 40 | #include "Trigger.h" |
---|
| 41 | |
---|
[2662] | 42 | namespace orxonox |
---|
| 43 | { |
---|
[2194] | 44 | /** |
---|
| 45 | @brief |
---|
[2221] | 46 | A PlayerTrigger is a trigger which is normally triggered by ControllableEntities and can as such return a pointer to the ControllableEntity which triggered it. |
---|
[2194] | 47 | @author |
---|
| 48 | Damian 'Mozork' Frick |
---|
| 49 | */ |
---|
| 50 | class _OrxonoxExport PlayerTrigger : public Trigger |
---|
| 51 | { |
---|
[2662] | 52 | public: |
---|
| 53 | PlayerTrigger(BaseObject* creator); |
---|
| 54 | virtual ~PlayerTrigger(); |
---|
| 55 | |
---|
| 56 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PlayerTrigger object through XML. |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | @brief Returns the player that triggered the PlayerTrigger. |
---|
| 60 | @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger. |
---|
| 61 | */ |
---|
| 62 | inline ControllableEntity* getTriggeringPlayer(void) const |
---|
| 63 | { return this->player_; } |
---|
| 64 | |
---|
| 65 | /** |
---|
| 66 | @brief Checks whether the PlayerTrigger normally returns a ControllableEntity. |
---|
| 67 | @return Returns true if the PlayerTrigger normally returns a ControllableEntity. |
---|
| 68 | */ |
---|
| 69 | inline bool isForPlayer(void) const |
---|
| 70 | { return this->isForPlayer_; } |
---|
[2194] | 71 | |
---|
[2662] | 72 | protected: |
---|
| 73 | virtual bool isTriggered(TriggerMode mode) = 0; |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | @brief Set the player that triggered the PlayerTrigger. This is normally done by classes inheriting vom PlayerTrigger. |
---|
| 77 | @param player A pointer to the ControllableEntity that triggered the PlayerTrigger. |
---|
| 78 | */ |
---|
| 79 | inline void setTriggeringPlayer(ControllableEntity* player) |
---|
| 80 | { this->player_ = player; } |
---|
[2221] | 81 | |
---|
| 82 | /** |
---|
| 83 | @brief Set whether the PlayerTrigger normally is triggered by ControllableEntities. |
---|
| 84 | @param isForPlayer Should be true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities, false if not. |
---|
| 85 | */ |
---|
[2662] | 86 | inline void setForPlayer(bool isForPlayer) |
---|
| 87 | { this->isForPlayer_ = isForPlayer; } |
---|
| 88 | |
---|
| 89 | private: |
---|
| 90 | ControllableEntity* player_; //!< The player that triggered the PlayerTrigger. |
---|
| 91 | bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities. |
---|
| 92 | |
---|
[2194] | 93 | }; |
---|
| 94 | |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | #endif /* _PlayerTrigger_H__ */ |
---|