Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Merged presentation3 branch into trunk.

  • Property svn:eol-style set to native
File size: 3.4 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*/
34
35#ifndef _ShieldPickup_H__
36#define _ShieldPickup_H__
37
38#include "pickup/PickupPrereqs.h"
39
40#include <string>
41#include "worldentities/pawns/Pawn.h"
42#include "worldentities/StaticEntity.h"
43
44#include "pickup/Pickup.h"
45
46namespace orxonox {
47
48    /**
49    @brief
50        A Pickup which can add a Shield to the Pawn.
51
52        1) The percentage: The percentage the shield takes from the damage dealt to a Pawn
53        2) The hit points: The amount of damage points a shield can teake before collapsing
54        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.
55        4) The duration: the activation time of the pickup.
56
57    @author
58        Eric Beier
59    */
60    class _PickupExport ShieldPickup : public Pickup
61    {
62        public:
63
64            ShieldPickup(BaseObject* creator); //!< Constructor.
65            virtual ~ShieldPickup(); //!< Destructor.
66
67            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
68
69            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
70            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
71
72            inline float getDuration(void)
73                { return this->duration_; }
74            inline float getShieldHealth()
75                { return this->shieldHealth_; }
76            inline float getShieldAbsorption()
77                { return this->shieldAbsorption_; }
78
79        protected:
80            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
81
82            virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends.
83
84            void setDuration(float duration);
85            void setShieldHealth(float shieldHealth);
86            void setShieldAbsorption(float shieldAbsorption);
87
88        private:
89            void initialize(void); //!< Initializes the member variables.
90            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
91
92            float duration_; //!< The health that is transferred to the Pawn.
93            float shieldHealth_;
94            float shieldAbsorption_; // Has to be between 0 and 1
95
96    };
97}
98
99#endif // _ShieldPickup_H__
Note: See TracBrowser for help on using the repository browser.