Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickup3/src/modules/pickup/Pickup.h @ 6474

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

Some documenting done. Added files, that I had forgotten to add. Cleaned the old pickups out.

File size: 4.6 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#ifndef _Pickup_H__
30#define Pickup_H__
31
32#include "pickup/PickupPrereqs.h"
33
34#include "interfaces/Pickupable.h"
35#include "core/BaseObject.h"
36#include "core/XMLPort.h"
37
38namespace orxonox
39{
40
41    //! Enum for the activation type.
42    namespace pickupActivationType
43    {
44        enum Value
45        {
46            immediate,
47            onUse,
48        };
49    }
50   
51    //! Enum for the duration tyoe.
52    namespace pickupDurationType
53    {
54        enum Value
55        {
56            once,
57            continuous,
58        };
59    }
60   
61    class _PickupExport Pickup : public Pickupable, public BaseObject
62    {
63       
64        public:
65           
66            Pickup(BaseObject* creator);
67            virtual ~Pickup();
68           
69            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
70           
71            /**
72            @brief Get the activation type of the pickup.
73            @return Returns the activation type of the pickup.
74            */
75            inline pickupActivationType::Value getActivationTypeDirect(void)
76                { return this->activationType_; }
77            /**
78            @brief Get the duration type of the pickup.
79            @return Returns the duration type of the pickup.
80            */
81            inline pickupDurationType::Value getDurationTypeDirect(void)
82                { return this->durationType_; }
83           
84            const std::string& getActivationType(void); //!< Get the activation type of the pickup.
85            const std::string& getDurationType(void); //!< Get the duration type of the pickup.
86           
87            inline bool isImmediate(void)
88                { return this->getActivationTypeDirect() == pickupActivationType::immediate; }
89            inline bool isOnUse(void)
90                { return this->getActivationTypeDirect() == pickupActivationType::onUse; }
91            inline bool isOnce(void)
92                { return this->getDurationTypeDirect() == pickupDurationType::once; }
93            inline bool isContinuous(void)
94                { return this->getDurationTypeDirect() == pickupDurationType::continuous; }
95                       
96            virtual void clone(OrxonoxClass* item);
97           
98            virtual void changedCarrier(void);
99               
100        protected:
101            void initializeIdentifier(void);
102           
103            /**
104            @brief Set the activation type of the pickup.
105            @param type The activation type of the pickup.
106            */
107            inline void setActivationTypeDirect(pickupActivationType::Value type)
108                { this->activationType_ = type; }
109            /**
110            @brief Set the duration type of the pickup.
111            @param type The duration type of the pickup.
112            */
113            inline void setDurationTypeDirect(pickupDurationType::Value type)
114                { this->durationType_ = type; }
115               
116            void setActivationType(const std::string& type); //!< Set the activation type of the pickup.
117            void setDurationType(const std::string& type); //!< Set the duration type of the pickup
118               
119        private:
120            pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
121            pickupDurationType::Value durationType_; //!< The duration type of the pickup.
122           
123            static const std::string activationTypeImmediate_s;
124            static const std::string activationTypeOnUse_s;
125            static const std::string durationTypeOnce_s;
126            static const std::string durationTypeContinuous_s;
127            static const std::string blankString_s; //TODO: Maybe already implemented somewhere?
128       
129    };
130   
131}
132#endif // _Pickup_H__
Note: See TracBrowser for help on using the repository browser.