Changeset 9348 for code/trunk/src/modules/pickup/PickupCollection.h
- Timestamp:
- Aug 30, 2012, 11:08:17 PM (12 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 .project 1 2 build 2 3 codeblocks 4 dependencies 3 5 vs 4 dependencies
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
code/trunk/src/modules/pickup/PickupCollection.h
r8351 r9348 50 50 The PickupCollection combines different @ref orxonox::Pickupable "Pickupables" (more precisely @ref orxonox::CollectiblePickup "CollectiblePickups") to a coherent, single pickup and makes them seem (from the outside looking in) just as if they were just one @ref orxonox::Pickupable "Pickupable". 51 51 52 To differentiate between different types of @ref orxonox::PickupCollection "PickupCollections" (just as we differentiate between different types of @ref orxonox::Pickupable "Pickupables") we define a new identifyer called the @ref orxonox::PickupCollectionIdentifier "PickupCollectionIdentifier" which has pretty much the same properties as the @ref orxonox::PickupIdentifier "PickupIdentifier" but extende to @ref orxonox::PickupCollection "PickupCollections".53 54 52 A PickupCollection can be created in XML as follows: 55 53 @code … … 81 79 virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around. 82 80 83 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input pickup.84 85 81 virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 86 82 87 virtual const PickupIdentifier* getPickupIdentifier(void) const; //!< Get the PickupIdentifier of this PickupCollection. 83 inline void setRepresentationName(const std::string& name) 84 { this->representationName_ = name; } 85 virtual const std::string& getRepresentationName() const 86 { return this->representationName_; } 88 87 89 88 bool addPickupable(CollectiblePickup* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection. 90 89 const Pickupable* getPickupable(unsigned int index) const; //!< Get the Pickupable at the given index. 90 bool removePickupable(CollectiblePickup* pickup); //!< Removes the input Pickupable from the list of Pickupables in this PickupCollection. 91 92 inline const std::list<CollectiblePickup*>& getPickups() const 93 { return this->pickups_; } 91 94 92 95 void pickupChangedUsed(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its used status to the input value. … … 95 98 96 99 protected: 97 void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup.98 99 100 virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 100 101 PickupCollectionIdentifier* pickupCollectionIdentifier_; //!< The PickupCollectionIdentifier of this PickupCollection. Is used to distinguish different PickupCollections amongst themselves.102 101 103 102 private: 104 103 void changedUsedAction(void); //!< Helper method. 105 104 void changedPickedUpAction(void); //!< Helper method. 105 void pickupsChanged(void); //!< Helper method. 106 106 107 std::vector<CollectiblePickup*> pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 108 109 unsigned int usedCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are in use. 110 unsigned int pickedUpCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are picked up. 111 unsigned int disabledCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are disabled. 107 std::string representationName_; //!< The name of the associated PickupRepresentation. 108 std::list<CollectiblePickup*> pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 112 109 113 110 bool processingUsed_; //!< Boolean to ensure, that the PickupCollection doesn't update its used status while its internal state is inconsistent.
Note: See TracChangeset
for help on using the changeset viewer.