Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pickup/items/MetaPickup.h @ 8692

Last change on this file since 8692 was 7547, checked in by dafrick, 14 years ago

Documenting and cleanup.

  • Property svn:eol-style set to native
File size: 5.3 KB
RevLine 
[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
42namespace orxonox {
43
[7547]44    /**
45    @brief
46        The meta type, specifying what the @ref orxonox::MetaPickup "MetaPickup" does exactly.
47
48    @ingroup PickupItems
49    */
[6518]50    namespace pickupMetaType
[6512]51    {
52        enum Value
53        {
[7547]54            none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing.
55            use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
56            drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
57            destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
58            destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier".
[6512]59        };
60    }
[7163]61
[6519]62    /**
63    @brief
[7547]64        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
65        - @b use All the @ref orxonox::Pickupable "Pickupables", the PickupCarrier has, are immediately set to used upon using the MetaPickup.
66        - @b drop All the @ref orxonox::Pickupable "Pickupables", the PickupCarrier has, are immediately dropped upon using the MetaPickup.
67        - @b destroy All the @ref orxonox::Pickupable "Pickupables", the PickupCarrier has, are immediately destroyed upon using the MetaPickup.
68        - @b destroyCarrier The PickupCarrier is immediately destroyed upon using the MetaPickup.
69
70        The default value is <em>none</em>, which basically does nothing.
71       
72        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.
73
74        An example of a XML implementation of a MetaPickup would be:
75        @code
76        <MetaPickup
77            activationType = "immediate"
78            metaType = "use"
79        />
80        @endcode
81
[6519]82    @author
83        Damian 'Mozork' Frick
[7547]84
85    @ingroup PickupItems
[6519]86    */
[6518]87    class _PickupExport MetaPickup : public Pickup
[6512]88    {
[7163]89
[6512]90        public:
[6538]91            MetaPickup(BaseObject* creator); //!< Constructor. Registers and initializes the object.
92            virtual ~MetaPickup(); //!< Destructor.
[7163]93
[6538]94            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML.
[7163]95
[6512]96            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
97            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
[7163]98
[6538]99            /**
100            @brief Returns the meta type of the MetaPickup.
101            @return Returns an enum with the meta type of the MetaPickup.
102            */
[7547]103            inline pickupMetaType::Value getMetaTypeDirect(void) const
[6518]104                { return this->metaType_; }
[7547]105            const std::string& getMetaType(void) const; //!< Get the meta type of this MetaPickup.
[7163]106
[6512]107        protected:
108            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
[7163]109
[6538]110            /**
111            @brief Set the meta type of the MetaPickup.
112            @param type The meta type as an enum.
113            */
[6518]114            inline void setMetaTypeDirect(pickupMetaType::Value type)
115                { this->metaType_ =  type; }
[6538]116            void setMetaType(const std::string& type); //!< Set the meta type of this MetaPickup.
[7163]117
[6512]118        private:
119            void initialize(void); //!< Initializes the member variables.
[7163]120
[6538]121            pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.
[7163]122
[6538]123            //! Static strings for the meta types.
[6518]124            static const std::string metaTypeNone_s;
125            static const std::string metaTypeUse_s;
126            static const std::string metaTypeDrop_s;
[7163]127            static const std::string metaTypeDestroy_s;
128            static const std::string metaTypeDestroyCarrier_s;
129
[6512]130    };
131
132}
133
134#endif // _TestPickup_H__
Note: See TracBrowser for help on using the repository browser.