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 | /** |
---|
30 | @file ShrinkPickup.h |
---|
31 | @brief Declaration of the ShrinkPickup class. |
---|
32 | @ingroup PickupItems |
---|
33 | */ |
---|
34 | |
---|
35 | |
---|
36 | #ifndef _ShrinkPickup_H__ |
---|
37 | #define _ShrinkPickup_H__ |
---|
38 | |
---|
39 | #include "pickup/PickupPrereqs.h" |
---|
40 | |
---|
41 | #include <string> |
---|
42 | #include <vector> |
---|
43 | |
---|
44 | #include "pickup/Pickup.h" |
---|
45 | #include "tools/interfaces/Tickable.h" |
---|
46 | |
---|
47 | namespace orxonox { |
---|
48 | |
---|
49 | /** |
---|
50 | @author |
---|
51 | Sandro Sgier |
---|
52 | |
---|
53 | @ingroup PickupItems |
---|
54 | */ |
---|
55 | |
---|
56 | /** |
---|
57 | @brief |
---|
58 | The ShrinkPickup is a Pickupable that causes the pawn to shrink to a certain size for a certain time with a certain speed, all of them specified in the following variables: |
---|
59 | - The @b shrinkFactor It determines how much the ship is going to shrink (e.g. the factor 2 would make the ship shrinking to half its size). |
---|
60 | - The @b duration Specifies how long the ship will keep small. |
---|
61 | - The @b shrinkSpeed Defines how fast the ship shrinks and grows. |
---|
62 | |
---|
63 | |
---|
64 | An example of a XML implementation of a HealthPickup would be: |
---|
65 | @code |
---|
66 | <HealthPickup |
---|
67 | shrinkFactor = "5.0" |
---|
68 | duration = "5.0" |
---|
69 | shrinkSpeed = "5.0" |
---|
70 | /> |
---|
71 | @endcode |
---|
72 | |
---|
73 | @author |
---|
74 | Sandro Sgier |
---|
75 | |
---|
76 | @ingroup PickupItems |
---|
77 | */ |
---|
78 | |
---|
79 | class _PickupExport ShrinkPickup : public Pickup, public Tickable |
---|
80 | { |
---|
81 | public: |
---|
82 | ShrinkPickup(BaseObject* creator); //!< Constructor. |
---|
83 | virtual ~ShrinkPickup(); //!< Destructor. |
---|
84 | virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. |
---|
85 | virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. |
---|
86 | virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); |
---|
87 | inline float getShrinkFactor(void) const |
---|
88 | { return this->shrinkFactor_; } |
---|
89 | inline float getDuration(void) const |
---|
90 | { return this->duration_; } |
---|
91 | inline float getShrinkSpeed(void) const |
---|
92 | { return this->shrinkSpeed_; } |
---|
93 | void setShrinkFactor(float factor); |
---|
94 | void setDuration(float duration); |
---|
95 | void setShrinkSpeed(float speed); |
---|
96 | void tick(float dt); |
---|
97 | |
---|
98 | protected: |
---|
99 | void initializeIdentifier(void); |
---|
100 | |
---|
101 | private: |
---|
102 | void initialize(void); |
---|
103 | float duration_; //!< determines how long the pickup will be active |
---|
104 | float shrinkFactor_; //shrink factor of the space ship |
---|
105 | float shrinkSpeed_; //speed of shrinking |
---|
106 | bool isActive_; //true if ship is shrinking or small |
---|
107 | bool isTerminating_; //true if ship is growing |
---|
108 | int size_; //number of camera positions |
---|
109 | std::list<SmartPtr<CameraPosition> > cameraPositions_; |
---|
110 | float defaultCameraPos_; //all default, actual and small values... |
---|
111 | Ogre::Vector3 defaultScale_; |
---|
112 | Ogre::Vector3 actualScale_; |
---|
113 | Ogre::Vector3 smallScale_; |
---|
114 | float defaultMass_; |
---|
115 | float actualMass_; |
---|
116 | float smallMass_; |
---|
117 | Pawn* carrierToPawnHelper(void); |
---|
118 | Pawn* pawn_; |
---|
119 | Timer durationTimer_; |
---|
120 | void terminate(void); |
---|
121 | }; |
---|
122 | } |
---|
123 | |
---|
124 | #endif |
---|