Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7479 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
RevLine 
[6474]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
[6540]29/**
30    @file Pickup.h
31    @brief Declaration of the Pickup class.
[7456]32    @ingroup Pickup
[6540]33*/
34
[6474]35#ifndef _Pickup_H__
[6475]36#define _Pickup_H__
[6474]37
38#include "pickup/PickupPrereqs.h"
39
40#include "core/BaseObject.h"
41#include "core/XMLPort.h"
42
[7163]43#include "CollectiblePickup.h"
[6475]44
[6709]45#include "tools/Timer.h"
46
[6474]47namespace orxonox
48{
49
50    //! Enum for the activation type.
51    namespace pickupActivationType
52    {
53        enum Value
54        {
55            immediate,
56            onUse,
57        };
58    }
[6709]59
[6474]60    //! Enum for the duration tyoe.
61    namespace pickupDurationType
62    {
63        enum Value
64        {
65            once,
66            continuous,
67        };
68    }
[6709]69
[6475]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    */
[7163]77    class _PickupExport Pickup : public CollectiblePickup, public BaseObject
[6474]78    {
[6709]79
[7163]80        public:
[6540]81            Pickup(BaseObject* creator); //!< Constructor.
[6475]82            virtual ~Pickup(); //!< Destructor.
[6709]83
[6474]84            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[6709]85
[6474]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_; }
[6709]98
[6474]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.
[6709]101
[6475]102            /**
103            @brief Get whether the activation type is 'immediate'.
104            @return Returns true if the activation type is 'immediate'.
105            */
[6474]106            inline bool isImmediate(void)
107                { return this->getActivationTypeDirect() == pickupActivationType::immediate; }
[6475]108            /**
109            @brief Get whether the activation type is 'onUse'.
110            @return Returns true if the activation type is 'onUse'.
111            */
[6474]112            inline bool isOnUse(void)
113                { return this->getActivationTypeDirect() == pickupActivationType::onUse; }
[6475]114            /**
115            @brief Get whether the duration type is 'once'.
116            @return Returns true if the duration type is 'once'.
117            */
[6474]118            inline bool isOnce(void)
119                { return this->getDurationTypeDirect() == pickupDurationType::once; }
[6475]120            /**
121            @brief Get whether the duration type is 'continuous'.
122            @return Returns true if the duration type is 'continuous'.
123            */
[6474]124            inline bool isContinuous(void)
125                { return this->getDurationTypeDirect() == pickupDurationType::continuous; }
[6709]126
[6521]127            virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
[6709]128
[6497]129            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the Pickup.
[6709]130
[6474]131        protected:
132            void initializeIdentifier(void);
[6709]133
[6540]134            virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
[6709]135
[6728]136            /**
[6474]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; }
[6709]148
[6474]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
[6709]151
[6474]152        private:
[6475]153            void initialize(void); //!< Initializes the member variables.
[7163]154
[6474]155            pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
156            pickupDurationType::Value durationType_; //!< The duration type of the pickup.
[6709]157
[6728]158            //! Strings for the activation and duration types.
[6474]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    };
[6709]164
[6474]165}
166#endif // _Pickup_H__
Note: See TracBrowser for help on using the repository browser.