Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Merged presentation3 branch into trunk.

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