[6512] | 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 | */ |
---|
| 28 | |
---|
[6519] | 29 | /** |
---|
[6538] | 30 | @file MetaPickup.h |
---|
[6519] | 31 | @brief Definition of the MetaPickup class. |
---|
| 32 | */ |
---|
| 33 | |
---|
[6518] | 34 | #ifndef _MetaPickup_H__ |
---|
| 35 | #define _MetaPickup_H__ |
---|
[6512] | 36 | |
---|
| 37 | #include "pickup/PickupPrereqs.h" |
---|
| 38 | |
---|
| 39 | #include "pickup/Pickup.h" |
---|
| 40 | |
---|
| 41 | namespace orxonox { |
---|
| 42 | |
---|
[6519] | 43 | //! The meta type, deciding what the pickup does exactly. |
---|
[6518] | 44 | namespace pickupMetaType |
---|
[6512] | 45 | { |
---|
| 46 | enum Value |
---|
| 47 | { |
---|
| 48 | none, |
---|
| 49 | use, |
---|
| 50 | drop |
---|
| 51 | }; |
---|
| 52 | } |
---|
| 53 | |
---|
[6519] | 54 | /** |
---|
| 55 | @brief |
---|
| 56 | The MetaPickup is a pickup that can, depending on the parameters, either drop all pickups of the PickupCarrier that picks it up, or use all the unused pickups of the PickupCarrier, that picks it up. The parameter to set for this is the metaType and it can be used with the values 'none', 'drop' and 'use'. |
---|
| 57 | @author |
---|
| 58 | Damian 'Mozork' Frick |
---|
| 59 | */ |
---|
[6518] | 60 | class _PickupExport MetaPickup : public Pickup |
---|
[6512] | 61 | { |
---|
| 62 | |
---|
| 63 | public: |
---|
[6538] | 64 | MetaPickup(BaseObject* creator); //!< Constructor. Registers and initializes the object. |
---|
| 65 | virtual ~MetaPickup(); //!< Destructor. |
---|
[6512] | 66 | |
---|
[6538] | 67 | virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML. |
---|
[6512] | 68 | |
---|
| 69 | virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. |
---|
| 70 | virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. |
---|
| 71 | |
---|
[6538] | 72 | /** |
---|
| 73 | @brief Returns the meta type of the MetaPickup. |
---|
| 74 | @return Returns an enum with the meta type of the MetaPickup. |
---|
| 75 | */ |
---|
[6518] | 76 | inline pickupMetaType::Value getMetaTypeDirect(void) |
---|
| 77 | { return this->metaType_; } |
---|
[6538] | 78 | const std::string& getMetaType(void); //!< Get the meta type of this MetaPickup. |
---|
[6512] | 79 | |
---|
| 80 | protected: |
---|
| 81 | void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. |
---|
| 82 | |
---|
[6538] | 83 | /** |
---|
| 84 | @brief Set the meta type of the MetaPickup. |
---|
| 85 | @param type The meta type as an enum. |
---|
| 86 | */ |
---|
[6518] | 87 | inline void setMetaTypeDirect(pickupMetaType::Value type) |
---|
| 88 | { this->metaType_ = type; } |
---|
[6538] | 89 | void setMetaType(const std::string& type); //!< Set the meta type of this MetaPickup. |
---|
[6512] | 90 | |
---|
| 91 | private: |
---|
| 92 | void initialize(void); //!< Initializes the member variables. |
---|
| 93 | |
---|
[6538] | 94 | pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. |
---|
| 95 | |
---|
| 96 | //! Static strings for the meta types. |
---|
[6518] | 97 | static const std::string metaTypeNone_s; |
---|
| 98 | static const std::string metaTypeUse_s; |
---|
| 99 | static const std::string metaTypeDrop_s; |
---|
[6512] | 100 | |
---|
| 101 | |
---|
| 102 | }; |
---|
| 103 | |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | #endif // _TestPickup_H__ |
---|