Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/environment/src/modules/pickup/items/ShieldPickup.h @ 8328

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

Fixing small bug in Script (regarding number of executions).
Fixed bug in WorldEntity, that caused the visibility and activity to be synchronized incorrectly (since bVisibleMem and bActiveMem are not synchronized).
Some small changed in documentation.
Started "synchronizing" pickups. Seems to work (except GUI), but haven't done any extensive testing yet.

  • 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        There are 4 parameters that can be cosen.
54        - The @b percentage The percentage the shield takes from the damage dealt to a Pawn
55        - The @b hit @b points The amount of damage points a shield can teake before collapsing
56        - The @b activation @b type 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it.
57        - The @b duration the activation time of the pickup.
58
59    @author
60        Eric Beier
61    */
62    class _PickupExport ShieldPickup : public Pickup
63    {
64        public:
65
66            ShieldPickup(BaseObject* creator); //!< Constructor.
67            virtual ~ShieldPickup(); //!< Destructor.
68
69            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
70
71            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
72            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
73
74            inline float getDuration(void)
75                { return this->duration_; }
76            inline float getShieldHealth()
77                { return this->shieldHealth_; }
78            inline float getShieldAbsorption()
79                { return this->shieldAbsorption_; }
80
81        protected:
82            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
83
84            void pickupTimerCallback(void); //!< Function that gets called when timer ends.
85
86            void setDuration(float duration);
87            void setShieldHealth(float shieldHealth);
88            void setShieldAbsorption(float shieldAbsorption);
89
90        private:
91            void initialize(void); //!< Initializes the member variables.
92            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
93
94            Timer durationTimer_; //!< Timer.
95
96            float duration_; //!< The health that is transferred to the Pawn.
97            float shieldHealth_;
98            float shieldAbsorption_; // Has to be between 0 and 1
99
100    };
101}
102
103#endif // _ShieldPickup_H__
Note: See TracBrowser for help on using the repository browser.