Changeset 7163 for code/trunk/src/orxonox/interfaces/Pickupable.h
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/interfaces/Pickupable.h
- Property svn:eol-style set to native
r6901 r7163 41 41 42 42 #include "core/OrxonoxClass.h" 43 #include "Rewardable.h" 43 44 44 namespace orxonox 45 { 46 45 namespace orxonox // tolua_export 46 { // tolua_export 47 47 48 /** 48 49 @brief … … 51 52 Damian 'Mozork' Frick 52 53 */ 53 class _OrxonoxExport Pickupable : virtual public OrxonoxClass 54 { 54 class _OrxonoxExport Pickupable // tolua_export 55 : virtual public OrxonoxClass, public Rewardable 56 { // tolua_export 55 57 protected: 56 58 Pickupable(); //!< Default constructor. 57 59 58 60 public: 59 61 virtual ~Pickupable(); //!< Default destructor. 60 62 61 63 /** 62 64 @brief Get whether the pickup is currently in use or not. 63 65 @return Returns true if the pickup is currently in use. 64 66 */ 65 inline bool isUsed(void) 66 { return this->used_; } 67 inline bool isUsed(void) { return this->used_; } // tolua_export 67 68 /** 68 69 @brief Should be called when the pickup has transited from used to unused or the other way around. … … 70 71 */ 71 72 virtual void changedUsed(void) {} 72 73 73 74 /** 74 75 @brief Get the carrier of the pickup. … … 82 83 */ 83 84 virtual void changedCarrier(void) {} 84 85 85 86 /** 86 87 @brief Returns whether the Pickupable is currently picked up. 87 88 @return Returns true if the Pickupable is currently picked up, false if not. 88 89 */ 89 inline bool isPickedUp(void) 90 { return this->pickedUp_; } 90 inline bool isPickedUp(void) { return this->pickedUp_; } // tolua_export 91 91 /** 92 92 @brief Should be called when the pickup has transited from picked up to dropped or the other way around. … … 94 94 */ 95 95 virtual void changedPickedUp(void) {} 96 97 /** 98 @brief Returns whether the Pickupable can be used. 99 @return Returns true if it can be used. 100 */ 101 inline bool isUsable(void) { return this->enabled_; } // tolua_export 96 102 97 bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up. 98 bool dropped(void); //!< Sets the Pickupable to not picked up or dropped. 99 103 /** 104 @brief Returns whether the Pickupable can be unused. 105 @return Returns true if it can be unused. 106 */ 107 inline bool isUnusable(void) { return this->enabled_; } // tolua_export 108 109 /** 110 @brief Returns whether the Pickupable is enabled. 111 Once a Pickupable is disabled it cannot be enabled again. A Pickupable that is disabled can neither be used nor unused. 112 @return Returns true if the Pickupable is enabled. 113 */ 114 inline bool isEnabled(void) 115 { return this->enabled_; } 116 117 bool pickup(PickupCarrier* carrier); //!< Can be called to pick up a Pickupable. 118 bool drop(bool createSpawner = true); //!< Can be called to drop a Pickupable. 119 100 120 virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup. 101 121 bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable. 102 122 bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup. 103 123 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup. 104 124 105 125 Pickupable* clone(void); //!< Creates a duplicate of the Pickupable. 106 126 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 107 127 108 128 /** 109 129 @brief Get the PickupIdentifier of this Pickupable. … … 112 132 virtual const PickupIdentifier* getPickupIdentifier(void) 113 133 { return this->pickupIdentifier_; } 114 134 115 135 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 116 136 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. 117 bool setCarrier(PickupCarrier* carrier); //!< Sets the carrier of the pickup. 118 137 //TODO: private? 138 bool setCarrier(PickupCarrier* carrier, bool tell = true); //!< Sets the carrier of the pickup. 139 140 //TODO: private? 141 virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed. 142 143 void destroy(void); //!< Is called internally within the pickup module to destroy pickups. 144 119 145 protected: 120 146 /** … … 122 148 */ 123 149 void initializeIdentifier(void) {} 124 150 151 virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed. 152 virtual void destroyPickup(void); //!< Destroys a Pickupable. 153 154 /** 155 @brief Sets the Pickuapble to disabled. 156 */ 157 inline void setDisabled(void) 158 { this->enabled_ = false; } 159 125 160 /** 126 161 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. … … 131 166 */ 132 167 virtual bool createSpawner(void) = 0; 133 168 134 169 PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable. 135 170 136 171 private: 137 138 bool used_; //!< Whether the pickup is currently in use or not.139 bool pickedUp_; //!< Whether the pickup is currently picked up or not.140 141 PickupCarrier* carrier_; //!< The carrier of the pickup.142 std::list<Identifier*> targets_; //!< The possible targets of this pickup.143 172 144 }; 145 173 bool used_; //!< Whether the Pickupable is currently in use or not. 174 bool pickedUp_; //!< Whether the Pickupable is currently picked up or not. 175 176 bool enabled_; //!< Whether the Pickupable is enabled or not. 177 178 PickupCarrier* carrier_; //!< The PickupCarrier of the Pickupable. 179 std::list<Identifier*> targets_; //!< The possible targets of this Pickupable. 180 181 bool beingDestroyed_; //!< Is true if the Pickupable is in the process of being destroyed. 182 183 // For implementing the Rewardable interface: 184 public: 185 virtual bool reward(PlayerInfo* player); //!< Method to transcribe a Pickupable as a Rewardable to the player. 186 187 }; // tolua_export 188 146 189 SUPER_FUNCTION(10, Pickupable, changedUsed, false); 147 190 SUPER_FUNCTION(12, Pickupable, changedCarrier, false); 148 191 SUPER_FUNCTION(13, Pickupable, changedPickedUp, false); 149 } 192 } // tolua_export 150 193 151 194 #endif /* _Pickupable_H__ */
Note: See TracChangeset
for help on using the changeset viewer.