Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pickup/items/ShieldPickup.h @ 7456

Last change on this file since 7456 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: 3.5 KB
Line 
1
2/*
3 *   ORXONOX - the hottest 3D action shooter ever to exist
4 *                    > www.orxonox.net <
5 *
6 *
7 *   License notice:
8 *
9 *   This program is free software; you can redistribute it and/or
10 *   modify it under the terms of the GNU General Public License
11 *   as published by the Free Software Foundation; either version 2
12 *   of the License, or (at your option) any later version.
13 *
14 *   This program is distributed in the hope that it will be useful,
15 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *   GNU General Public License for more details.
18 *
19 *   You should have received a copy of the GNU General Public License
20 *   along with this program; if not, write to the Free Software
21 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 *
23 *   Author:
24 *      Eric Beier
25 *   Co-authors:
26 *      ...
27 *
28 */
29
30/**
31    @file ShieldPickup.h
32    @brief Declaration of the ShieldPickup class.
33    @ingroup PickupItems
34*/
35
36#ifndef _ShieldPickup_H__
37#define _ShieldPickup_H__
38
39#include "pickup/PickupPrereqs.h"
40
41#include <string>
42#include "worldentities/pawns/Pawn.h"
43#include "worldentities/StaticEntity.h"
44
45#include "pickup/Pickup.h"
46
47namespace orxonox {
48
49    /**
50    @brief
51        A Pickup which can add a Shield to the Pawn.
52
53        1) The percentage: The percentage the shield takes from the damage dealt to a Pawn
54        2) The hit points: The amount of damage points a shield can teake before collapsing
55        3) The activation type: 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it.
56        4) The duration: the activation time of the pickup.
57
58    @author
59        Eric Beier
60    */
61    class _PickupExport ShieldPickup : public Pickup
62    {
63        public:
64
65            ShieldPickup(BaseObject* creator); //!< Constructor.
66            virtual ~ShieldPickup(); //!< Destructor.
67
68            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
69
70            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
71            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
72
73            inline float getDuration(void)
74                { return this->duration_; }
75            inline float getShieldHealth()
76                { return this->shieldHealth_; }
77            inline float getShieldAbsorption()
78                { return this->shieldAbsorption_; }
79
80        protected:
81            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
82
83            void pickupTimerCallback(void); //!< Function that gets called when timer ends.
84
85            void setDuration(float duration);
86            void setShieldHealth(float shieldHealth);
87            void setShieldAbsorption(float shieldAbsorption);
88
89        private:
90            void initialize(void); //!< Initializes the member variables.
91            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
92
93            Timer durationTimer_; //!< Timer.
94
95            float duration_; //!< The health that is transferred to the Pawn.
96            float shieldHealth_;
97            float shieldAbsorption_; // Has to be between 0 and 1
98
99    };
100}
101
102#endif // _ShieldPickup_H__
Note: See TracBrowser for help on using the repository browser.