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 | * Nino Weingart |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | /** |
---|
30 | @file FlagPickup.h |
---|
31 | @brief Declaration of the FlagPickup class. |
---|
32 | @ingroup PickupItems |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _FlagPickup_H__ |
---|
36 | #define _FlagPickup_H__ |
---|
37 | |
---|
38 | #include "pickup/PickupPrereqs.h" |
---|
39 | |
---|
40 | #include <string> |
---|
41 | |
---|
42 | #include "pickup/Pickup.h" |
---|
43 | |
---|
44 | namespace orxonox { |
---|
45 | |
---|
46 | @ingroup PickupItems |
---|
47 | */ |
---|
48 | namespace pickupFlagType |
---|
49 | { |
---|
50 | enum Value |
---|
51 | { |
---|
52 | blue, //!< Means that the @ref orxonox::FlagPickup "FlagPickup" is the flag of the blue team. |
---|
53 | red, //!< Means that the @ref orxonox::FlagPickup "FlagPickup" is the flag of the red team. |
---|
54 | neutral //!< Means that the @ref orxonox::FlagPickup "FlagPickup" is a neutral flag. |
---|
55 | }; |
---|
56 | } |
---|
57 | |
---|
58 | /** |
---|
59 | |
---|
60 | @author |
---|
61 | Nino Weingart |
---|
62 | |
---|
63 | @ingroup PickupItems |
---|
64 | */ |
---|
65 | class _PickupExport FlagPickup : public Pickup, public Tickable |
---|
66 | { |
---|
67 | public: |
---|
68 | |
---|
69 | FlagPickup(BaseObject* creator); //!< Constructor. |
---|
70 | virtual ~FlagPickup(); //!< Destructor. |
---|
71 | |
---|
72 | virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a FlagPickup object through XML. |
---|
73 | |
---|
74 | virtual void tick(float dt); |
---|
75 | |
---|
76 | const std::string& getFlagType(void) const; //!< Get the flag type of this pickup. |
---|
77 | |
---|
78 | |
---|
79 | virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. |
---|
80 | |
---|
81 | protected: |
---|
82 | void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. |
---|
83 | |
---|
84 | /** |
---|
85 | @brief Set the flag type of this pickup. |
---|
86 | @param type The type of this pickup as an enum. |
---|
87 | */ |
---|
88 | inline void setFlagTypeDirect(pickupFlagType::Value type) |
---|
89 | { this->flagType_ = type; } |
---|
90 | void setFlagType(std::string type); //!< Set the type of the FlagPickup. |
---|
91 | |
---|
92 | private: |
---|
93 | Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. |
---|
94 | int getTeam(PlayerInfo* player); |
---|
95 | void initialize(void); //!< Initializes the member variables. |
---|
96 | |
---|
97 | pickupFlagType::Value flagType_; //!< The type of the FlagPickup. |
---|
98 | |
---|
99 | int teamScore_; |
---|
100 | |
---|
101 | //! Strings for the flag types. |
---|
102 | static const std::string flagTypeBlue_s; |
---|
103 | static const std::string flagTypeRed_s; |
---|
104 | static const std::string flagTypeNeutral_s; |
---|
105 | |
---|
106 | }; |
---|
107 | } |
---|
108 | |
---|
109 | #endif // _FlagPickup_H__ |
---|