Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pickup/Pickup.h @ 7474

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

Reviewing documentation fo Questsystem, moving documentation fully into doxygen.
Added some files to modules they belong to.

  • Property svn:eol-style set to native
File size: 5.7 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 Pickup.h
31    @brief Declaration of the Pickup class.
32    @ingroup Pickup
33*/
34
35#ifndef _Pickup_H__
36#define _Pickup_H__
37
38#include "pickup/PickupPrereqs.h"
39
40#include "core/BaseObject.h"
41#include "core/XMLPort.h"
42
43#include "CollectiblePickup.h"
44
45#include "tools/Timer.h"
46
47namespace orxonox
48{
49
50    //! Enum for the activation type.
51    namespace pickupActivationType
52    {
53        enum Value
54        {
55            immediate,
56            onUse,
57        };
58    }
59
60    //! Enum for the duration tyoe.
61    namespace pickupDurationType
62    {
63        enum Value
64        {
65            once,
66            continuous,
67        };
68    }
69
70    /**
71    @brief
72        Pickup class. Offers base functionality for a wide range of pickups.
73        Pickups ingeriting from this class cann choose an activation type and a duration type.
74    @author
75        Damian 'Mozork' Frick
76    */
77    class _PickupExport Pickup : public CollectiblePickup, public BaseObject
78    {
79
80        public:
81            Pickup(BaseObject* creator); //!< Constructor.
82            virtual ~Pickup(); //!< Destructor.
83
84            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
85
86            /**
87            @brief Get the activation type of the pickup.
88            @return Returns the activation type of the pickup.
89            */
90            inline pickupActivationType::Value getActivationTypeDirect(void)
91                { return this->activationType_; }
92            /**
93            @brief Get the duration type of the pickup.
94            @return Returns the duration type of the pickup.
95            */
96            inline pickupDurationType::Value getDurationTypeDirect(void)
97                { return this->durationType_; }
98
99            const std::string& getActivationType(void); //!< Get the activation type of the pickup.
100            const std::string& getDurationType(void); //!< Get the duration type of the pickup.
101
102            /**
103            @brief Get whether the activation type is 'immediate'.
104            @return Returns true if the activation type is 'immediate'.
105            */
106            inline bool isImmediate(void)
107                { return this->getActivationTypeDirect() == pickupActivationType::immediate; }
108            /**
109            @brief Get whether the activation type is 'onUse'.
110            @return Returns true if the activation type is 'onUse'.
111            */
112            inline bool isOnUse(void)
113                { return this->getActivationTypeDirect() == pickupActivationType::onUse; }
114            /**
115            @brief Get whether the duration type is 'once'.
116            @return Returns true if the duration type is 'once'.
117            */
118            inline bool isOnce(void)
119                { return this->getDurationTypeDirect() == pickupDurationType::once; }
120            /**
121            @brief Get whether the duration type is 'continuous'.
122            @return Returns true if the duration type is 'continuous'.
123            */
124            inline bool isContinuous(void)
125                { return this->getDurationTypeDirect() == pickupDurationType::continuous; }
126
127            virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
128
129            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the Pickup.
130
131        protected:
132            void initializeIdentifier(void);
133
134            virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
135
136            /**
137            @brief Set the activation type of the pickup.
138            @param type The activation type of the pickup.
139            */
140            inline void setActivationTypeDirect(pickupActivationType::Value type)
141                { this->activationType_ = type; }
142            /**
143            @brief Set the duration type of the pickup.
144            @param type The duration type of the pickup.
145            */
146            inline void setDurationTypeDirect(pickupDurationType::Value type)
147                { this->durationType_ = type; }
148
149            void setActivationType(const std::string& type); //!< Set the activation type of the pickup.
150            void setDurationType(const std::string& type); //!< Set the duration type of the pickup
151
152        private:
153            void initialize(void); //!< Initializes the member variables.
154
155            pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
156            pickupDurationType::Value durationType_; //!< The duration type of the pickup.
157
158            //! Strings for the activation and duration types.
159            static const std::string activationTypeImmediate_s;
160            static const std::string activationTypeOnUse_s;
161            static const std::string durationTypeOnce_s;
162            static const std::string durationTypeContinuous_s;
163    };
164
165}
166#endif // _Pickup_H__
Note: See TracBrowser for help on using the repository browser.