- Timestamp:
- Mar 5, 2010, 6:26:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/PickupRepresentation.h
r6474 r6475 32 32 #include "PickupPrereqs.h" 33 33 34 #include "core/XMLPort.h" 35 #include "interfaces/Pickupable.h" 36 #include "pickup/PickupIdentifier.h" 37 #include "worldentities/StaticEntity.h" 38 #include "PickupSpawner.h" 39 34 40 #include "core/BaseObject.h" 35 36 #include "core/XMLPort.h"37 #include "pickup/PickupIdentifier.h"38 #include "interfaces/Pickupable.h"39 #include "pickup/PickupSpawner.h"40 #include "worldentities/StaticEntity.h"41 41 42 42 namespace orxonox 43 43 { 44 44 45 /** 46 @brief 47 The PickupRepresentation class represents a specific pickup type (identified by its PickupIdentifier). It defines the information displayed in the GUI and how PickupSpawners that spawn the pickup type look like. 48 They are created through XML and are registered with the PickupManager. 49 */ 45 50 class _PickupExport PickupRepresentation : public BaseObject 46 51 { 47 52 48 53 public: 49 PickupRepresentation(); 50 PickupRepresentation(BaseObject* creator); 51 virtual ~PickupRepresentation(); 54 PickupRepresentation(); //!< Constructor 55 PickupRepresentation(BaseObject* creator); //!< Default constructor. 56 virtual ~PickupRepresentation(); //!< Destructor. 52 57 53 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 59 60 /** 61 @brief Set the name of the Pickupable represented by this PickupRepresentation. 62 @param name The name. 63 */ 55 64 inline void setName(const std::string& name) 56 65 { this->name_ = name; } 66 /** 67 @brief Set the description of the Pickupable represented by this PickupRepresentation. 68 @param description The Description. 69 */ 57 70 inline void setDescription(const std::string& description) 58 71 { this->description_ = description; } 72 /** 73 @brief Set the spawnerTemplate of the Pickupable represented by this PickupRepresentation. 74 The spawnerTemplate is a name of a template defined in XML that defines the StaticEntity that is the spawnerRepresentation of this PickupRepresentation. 75 @param spawnerTemplate The name of the template. 76 */ 59 77 inline void setSpawnerTemplate(const std::string& spawnerTemplate) 60 78 { this->spawnerTemplate_ = spawnerTemplate; } 79 /** 80 @brief Set the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like. 81 This will be set by the spawnerTemplate. Setting it when creating the PickupRepresentation without creating a template and specifying its name will be futile, because through the course of the game many PickupSpawners for one specific pickup type may have to be created, thus the StaticEntity that is the spawnerRepresentation has to be generated (with the template) for every new PickupSpawner spawning the Pickupable represented by this PickupRepresentation. The spawnerRepresentation that is set here, however can only be used once. 82 @param representation A pointer to the StaticEntity that is the spawnerRepresentation of this PickupRepresentation. 83 */ 61 84 inline void setSpawnerRepresentation(StaticEntity* representation) 62 85 { this->spawnerRepresentation_ = representation; } 86 /** 87 @brief Set the Pickupable that is represented by this PickupRepresentation. 88 @param pickup A pointer to the Pickupable. 89 */ 63 90 inline void setPickup(Pickupable* pickup) 64 91 { this->pickup_ = pickup; } 65 92 93 /** 94 @brief Get the name of the Pickupable represented by this PickupRepresentation. 95 @return Returns the name. 96 */ 66 97 inline const std::string& getName(void) 67 98 { return this->name_; } 99 /** 100 @brief Get the description of the Pickupable represented by this PickupRepresentation. 101 @return Returns the description. 102 */ 68 103 inline const std::string& getDescription(void) 69 104 { return this->description_; } 105 /** 106 @brief Get the name of spawnerTemplate the Pickupable represented by this PickupRepresentation. 107 @return Returns the name of the spawnerTemplate. 108 */ 70 109 inline const std::string& getSpawnerTemplate(void) 71 110 { return this->spawnerTemplate_; } 111 /** 112 @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like. 113 @param index The index. 114 @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL. 115 */ 72 116 inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index) 73 117 { if(index == 0) return this->spawnerRepresentation_; return NULL; } 118 /** 119 @brief Get the Pickupable represented by this PickupRepresentation. 120 @param index The index. 121 @return Returns (for index = 0) a pointer to the Pickupable. For index > 0 it returns NULL. 122 */ 74 123 inline const Pickupable* getPickup(unsigned int index) 75 124 { if(index == 0) return this->pickup_; return NULL; } 76 125 77 StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); 126 StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner. 78 127 79 128 private: 80 void initialize(void); 81 StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); 129 void initialize(void); //!< Initializes the member variables of this PickupRepresentation. 130 StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner. 82 131 83 std::string name_; 84 std::string description_; 85 std::string spawnerTemplate_; 86 StaticEntity* spawnerRepresentation_; 132 std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation. 133 std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation. 134 std::string spawnerTemplate_; //!< The name of the template of this PickupRepresentation. 135 StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation. 87 136 88 Pickupable* pickup_; 89 137 Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation. 90 138 91 139 };
Note: See TracChangeset
for help on using the changeset viewer.