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