[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 | |
---|
[7547] | 44 | /** |
---|
| 45 | @brief |
---|
| 46 | The meta type, specifying what the @ref orxonox::MetaPickup "MetaPickup" does exactly. |
---|
| 47 | |
---|
| 48 | @ingroup PickupItems |
---|
| 49 | */ |
---|
[11071] | 50 | enum class PickupMetaType |
---|
[6512] | 51 | { |
---|
[11071] | 52 | none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. |
---|
| 53 | use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". |
---|
| 54 | drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". |
---|
| 55 | destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". |
---|
| 56 | destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". |
---|
| 57 | }; |
---|
[7163] | 58 | |
---|
[6519] | 59 | /** |
---|
| 60 | @brief |
---|
[7547] | 61 | The MetaPickup is a Pickupable that can, depending on the parameter <em>metaTye</em>, do different things. If the <em>metaTye</em> is set to |
---|
| 62 | - @b use All the @ref orxonox::Pickupable "Pickupables", the PickupCarrier has, are immediately set to used upon using the MetaPickup. |
---|
| 63 | - @b drop All the @ref orxonox::Pickupable "Pickupables", the PickupCarrier has, are immediately dropped upon using the MetaPickup. |
---|
| 64 | - @b destroy All the @ref orxonox::Pickupable "Pickupables", the PickupCarrier has, are immediately destroyed upon using the MetaPickup. |
---|
| 65 | - @b destroyCarrier The PickupCarrier is immediately destroyed upon using the MetaPickup. |
---|
| 66 | |
---|
| 67 | The default value is <em>none</em>, which basically does nothing. |
---|
[9348] | 68 | |
---|
[7547] | 69 | The parameter <b>activation type</b> can be used to specify, whether the MetaPickup is used upon pickup (<em>immediate</em>) or not (<em>onUse</em>). With <em>immediate</em> being the default. |
---|
| 70 | |
---|
| 71 | An example of a XML implementation of a MetaPickup would be: |
---|
| 72 | @code |
---|
| 73 | <MetaPickup |
---|
| 74 | activationType = "immediate" |
---|
| 75 | metaType = "use" |
---|
| 76 | /> |
---|
| 77 | @endcode |
---|
| 78 | |
---|
[6519] | 79 | @author |
---|
| 80 | Damian 'Mozork' Frick |
---|
[7547] | 81 | |
---|
| 82 | @ingroup PickupItems |
---|
[6519] | 83 | */ |
---|
[6518] | 84 | class _PickupExport MetaPickup : public Pickup |
---|
[6512] | 85 | { |
---|
[7163] | 86 | |
---|
[6512] | 87 | public: |
---|
[9667] | 88 | MetaPickup(Context* context); //!< Constructor. Registers and initializes the object. |
---|
[6538] | 89 | virtual ~MetaPickup(); //!< Destructor. |
---|
[7163] | 90 | |
---|
[6538] | 91 | virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML. |
---|
[7163] | 92 | |
---|
[6512] | 93 | virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. |
---|
[7163] | 94 | |
---|
[6538] | 95 | /** |
---|
| 96 | @brief Returns the meta type of the MetaPickup. |
---|
| 97 | @return Returns an enum with the meta type of the MetaPickup. |
---|
| 98 | */ |
---|
[11071] | 99 | inline PickupMetaType getMetaType(void) const |
---|
[6518] | 100 | { return this->metaType_; } |
---|
[9348] | 101 | const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. |
---|
[7163] | 102 | |
---|
[6512] | 103 | protected: |
---|
[6538] | 104 | /** |
---|
| 105 | @brief Set the meta type of the MetaPickup. |
---|
| 106 | @param type The meta type as an enum. |
---|
| 107 | */ |
---|
[11071] | 108 | inline void setMetaType(PickupMetaType type) |
---|
[6518] | 109 | { this->metaType_ = type; } |
---|
[9348] | 110 | void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. |
---|
[7163] | 111 | |
---|
[6512] | 112 | private: |
---|
| 113 | void initialize(void); //!< Initializes the member variables. |
---|
[7163] | 114 | |
---|
[11071] | 115 | PickupMetaType metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. |
---|
[7163] | 116 | |
---|
[6538] | 117 | //! Static strings for the meta types. |
---|
[6518] | 118 | static const std::string metaTypeNone_s; |
---|
| 119 | static const std::string metaTypeUse_s; |
---|
| 120 | static const std::string metaTypeDrop_s; |
---|
[7163] | 121 | static const std::string metaTypeDestroy_s; |
---|
| 122 | static const std::string metaTypeDestroyCarrier_s; |
---|
| 123 | |
---|
[6512] | 124 | }; |
---|
| 125 | |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | #endif // _TestPickup_H__ |
---|