[9218] | 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" |
---|
[9232] | 39 | #include "worldentities/pawns/Pawn.h" |
---|
[9218] | 40 | |
---|
| 41 | #include <string> |
---|
| 42 | |
---|
| 43 | #include "pickup/Pickup.h" |
---|
[9220] | 44 | #include "tools/Timer.h" |
---|
[9232] | 45 | #include "tools/interfaces/Tickable.h" |
---|
[9218] | 46 | |
---|
[9220] | 47 | |
---|
[9218] | 48 | namespace orxonox { |
---|
[9220] | 49 | /* |
---|
[9218] | 50 | @ingroup PickupItems |
---|
[9232] | 51 | |
---|
[9218] | 52 | |
---|
| 53 | @author |
---|
| 54 | Nino Weingart |
---|
| 55 | |
---|
| 56 | @ingroup PickupItems |
---|
| 57 | */ |
---|
| 58 | class _PickupExport FlagPickup : public Pickup, public Tickable |
---|
| 59 | { |
---|
| 60 | public: |
---|
| 61 | |
---|
| 62 | FlagPickup(BaseObject* creator); //!< Constructor. |
---|
| 63 | virtual ~FlagPickup(); //!< Destructor. |
---|
| 64 | |
---|
| 65 | virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a FlagPickup object through XML. |
---|
| 66 | |
---|
| 67 | virtual void tick(float dt); |
---|
| 68 | |
---|
[9232] | 69 | const int getFlagType(void) const; //!< Get the flag type of this pickup. |
---|
| 70 | |
---|
| 71 | inline bool isPickedUp() const |
---|
| 72 | { return this->bPickedUp_; } |
---|
| 73 | inline Pawn* pickedUpBy() const |
---|
| 74 | { return this->pickedUpBy_; } |
---|
| 75 | |
---|
| 76 | inline void setPickedUp(bool pickedUp) |
---|
| 77 | { this->bPickedUp_ = pickedUp; } |
---|
| 78 | |
---|
| 79 | inline void ignorePickedUp() |
---|
| 80 | { this->Pickupable::destroy(); } |
---|
| 81 | |
---|
[9218] | 82 | virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. |
---|
| 83 | |
---|
| 84 | protected: |
---|
| 85 | void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. |
---|
| 86 | |
---|
| 87 | /** |
---|
| 88 | @brief Set the flag type of this pickup. |
---|
| 89 | @param type The type of this pickup as an enum. |
---|
| 90 | */ |
---|
[9232] | 91 | inline void setFlagTypeDirect(int type) |
---|
[9218] | 92 | { this->flagType_ = type; } |
---|
[9232] | 93 | void setFlagType(int type); //!< Set the type of the FlagPickup. |
---|
[9218] | 94 | |
---|
| 95 | private: |
---|
| 96 | Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. |
---|
| 97 | void initialize(void); //!< Initializes the member variables. |
---|
[9232] | 98 | Pawn* pickedUpBy_; |
---|
| 99 | int flagType_; |
---|
| 100 | |
---|
| 101 | bool bPickedUp_; |
---|
| 102 | |
---|
[9218] | 103 | }; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | #endif // _FlagPickup_H__ |
---|