Orxonox
0.0.5 Codename: Arcturus
|
An Interface (or more precisely an abstract class) to model and represent different (all kinds of) pickups. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/orxonox/interfaces/Pickupable.h>
Public Member Functions | |
virtual | ~Pickupable () |
Default destructor. More... | |
bool | addTarget (PickupCarrier *target) |
Add a PickupCarrier as target of this Pickupable. More... | |
bool | addTarget (Identifier *identifier) |
Add a class, representetd by the input Identifier, as target of this Pickupable. More... | |
virtual void | changedCarrier (void) |
Should be called when the Pickupable has changed its PickupCarrier. More... | |
virtual void | changedPickedUp (void) |
Should be called when the Pickupable has transited from picked up to dropped or the other way around. More... | |
virtual void | changedUsed (void) |
Should be called when the Pickupable has transited from used to unused or the other way around. More... | |
void | destroy (void) |
Is called internally within the Pickupable module to destroy pickups. More... | |
bool | drop (bool createSpawner=true) |
Can be called to drop a Pickupable. More... | |
PickupCarrier * | getCarrier (void) |
Get the carrier of the Pickupable. More... | |
virtual const std::string & | getRepresentationName () const =0 |
Returns the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup. More... | |
bool | isEnabled (void) const |
Returns whether the Pickupable is enabled. More... | |
bool | isPickedUp (void) const |
Returns whether the Pickupable is currently picked up. More... | |
virtual bool | isTarget (const PickupCarrier *carrier) const |
Get whether the given PickupCarrier is a target of this Pickupable. More... | |
bool | isTarget (const Identifier *identifier) const |
Get whether a given class, represented by the input Identifier, is a target of this Pickupable. More... | |
bool | isUnusable (void) const |
Returns whether the Pickupable can be unused. More... | |
bool | isUsable (void) const |
Returns whether the Pickupable can be used. More... | |
bool | isUsed (void) const |
Get whether the Pickupable is currently in use or not. More... | |
bool | pickup (PickupCarrier *carrier) |
Can be called to pick up a Pickupable. More... | |
virtual bool | reward (PlayerInfo *player) override |
Method to transcribe a Pickupable as a Rewardable to the player. More... | |
bool | setCarrier (PickupCarrier *carrier, bool tell=true) |
Sets the carrier of the Pickupable. More... | |
bool | setPickedUp (bool pickedUp) |
Helper method to set the Pickupable to either picked up or not picked up. More... | |
bool | setUsed (bool used) |
Sets the Pickupable to used or unused, depending on the input. More... | |
Public Member Functions inherited from orxonox::OrxonoxInterface | |
OrxonoxInterface () | |
Public Member Functions inherited from orxonox::Configurable | |
Configurable () | |
void | setConfigValues () |
Function to collect the SetConfigValue-macro calls. More... | |
Public Member Functions inherited from orxonox::Listable | |
Listable () | |
Constructor: Allocates space in the element list. More... | |
Listable (Context *context) | |
Constructor: Allocates space in the element list and assigns the context. More... | |
virtual | ~Listable () |
Destructor: Removes the object from the object-lists. More... | |
Context * | getContext () const |
void | setContext (Context *context) |
Changes the context. More... | |
void | unregisterObject () |
Removes this object from the object-lists. More... | |
Public Member Functions inherited from orxonox::Identifiable | |
Identifiable () | |
Constructor: Sets the default values. More... | |
virtual | ~Identifiable () |
ORX_FORCEINLINE void * | getDerivedPointer (unsigned int classID) |
Returns a valid pointer of any derived type that is registered in the class hierarchy. More... | |
template<class T > | |
ORX_FORCEINLINE T * | getDerivedPointer (unsigned int classID) |
Version of getDerivedPointer with template. More... | |
template<class T > | |
ORX_FORCEINLINE const T * | getDerivedPointer (unsigned int classID) const |
Const version of getDerivedPointer with template. More... | |
Identifier * | getIdentifier () const |
Returns the Identifier of the object. More... | |
bool | isA (const Identifier *identifier) |
Returns true if the object's class is of the given type or a derivative. More... | |
template<class B > | |
bool | isA (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is of the given type or a derivative. More... | |
bool | isA (const Identifiable *object) |
Returns true if the object's class is of the given type or a derivative. More... | |
bool | isChildOf (const Identifier *identifier) |
Returns true if the object's class is a child of the given type. More... | |
template<class B > | |
bool | isChildOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a child of the given type. More... | |
bool | isChildOf (const Identifiable *object) |
Returns true if the object's class is a child of the given type. More... | |
bool | isDirectChildOf (const Identifier *identifier) |
Returns true if the object's class is a direct child of the given type. More... | |
template<class B > | |
bool | isDirectChildOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isDirectChildOf (const Identifiable *object) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isDirectParentOf (const Identifier *identifier) |
Returns true if the object's class is a direct parent of the given type. More... | |
template<class B > | |
bool | isDirectParentOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a direct parent of the given type. More... | |
bool | isDirectParentOf (const Identifiable *object) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isExactlyA (const Identifier *identifier) |
Returns true if the object's class is exactly of the given type. More... | |
template<class B > | |
bool | isExactlyA (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is exactly of the given type. More... | |
bool | isExactlyA (const Identifiable *object) |
Returns true if the object's class is exactly of the given type. More... | |
bool | isParentOf (const Identifier *identifier) |
Returns true if the object's class is a parent of the given type. More... | |
template<class B > | |
bool | isParentOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a parent of the given type. More... | |
bool | isParentOf (const Identifiable *object) |
Returns true if the object's class is a parent of the given type. More... | |
Public Member Functions inherited from orxonox::Destroyable | |
Destroyable () | |
Constructor: Sets the default values. More... | |
virtual | ~Destroyable () |
Destructor: Notifies all DestructionListener (for example weak pointers) that this object is being deleted. More... | |
void | destroy () |
Deletes the object if no strong pointers point to this object. More... | |
void | destroyLater () |
Works like destroy() but doesn't destroy the object until the current tick has ended. More... | |
unsigned int | getReferenceCount () const |
Returns the number of strong pointers that point to this object. More... | |
Public Member Functions inherited from orxonox::Rewardable | |
Rewardable () | |
virtual | ~Rewardable () |
Protected Member Functions | |
Pickupable () | |
Default constructor. More... | |
virtual void | carrierDestroyed (void) |
Is called by the PickupCarrier when it is being destroyed. More... | |
virtual bool | createSpawner (void)=0 |
Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. More... | |
virtual void | destroyPickup (void) |
Destroys a Pickupable. More... | |
bool | isBeingDestroyed (void) |
Check whether the Pickupable is in the process of being destroyed. More... | |
virtual void | preDestroy (void) override |
A method that is called by Destroyable::destroy() before the object is actually destroyed. More... | |
void | setDisabled (void) |
Sets the Pickuapble to disabled. More... | |
Private Attributes | |
bool | beingDestroyed_ |
Is true if the Pickupable is in the process of being destroyed. More... | |
PickupCarrier * | carrier_ |
The PickupCarrier of the Pickupable. More... | |
bool | enabled_ |
Whether the Pickupable is enabled or not. More... | |
bool | pickedUp_ |
Whether the Pickupable is currently picked up or not. More... | |
std::list< Identifier * > | targets_ |
The possible targets of this Pickupable. More... | |
bool | used_ |
Whether the Pickupable is currently in use or not. More... | |
Friends | |
class | PickupCarrier |
An Interface (or more precisely an abstract class) to model and represent different (all kinds of) pickups.
Pickups (Pickupables) are objects that (quite unsurprisingly) can be picked up. Additionally they can be used and unused (transition from used to not used), and also dropped.
|
protected |
Default constructor.
Constructor.
Registers the objects and initializes its member variables.
|
virtual |
Default destructor.
Destructor.
bool orxonox::Pickupable::addTarget | ( | PickupCarrier * | target | ) |
Add a PickupCarrier as target of this Pickupable.
target | The PickupCarrier to be added. |
bool orxonox::Pickupable::addTarget | ( | Identifier * | target | ) |
Add a class, representetd by the input Identifier, as target of this Pickupable.
target | The Identifier to be added. |
Is called by the PickupCarrier when it is being destroyed.
Should be called when the Pickupable has changed its PickupCarrier.
Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedCarrier); to their changedCarrier method.
Reimplemented in orxonox::PickupCollection.
Should be called when the Pickupable has transited from picked up to dropped or the other way around.
Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedPickedUp); to their changedPickedUp method.
Reimplemented in orxonox::Pickup, orxonox::ShrinkPickup, orxonox::PickupCollection, and orxonox::CollectiblePickup.
Should be called when the Pickupable has transited from used to unused or the other way around.
Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedUsed); to their changdeUsed method.
Reimplemented in orxonox::HealthPickup, orxonox::MetaPickup, orxonox::ShieldPickup, orxonox::SpeedPickup, orxonox::ShrinkPickup, orxonox::PickupCollection, orxonox::InvisiblePickup, orxonox::DronePickup, orxonox::CollectiblePickup, orxonox::MunitionPickup, orxonox::BoostPickup, and orxonox::DamageBoostPickup.
|
protectedpure virtual |
Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
This method must be implemented by any class directly inheriting from Pickupable.
Implemented in orxonox::Pickup, and orxonox::PickupCollection.
Is called internally within the Pickupable module to destroy pickups.
Is called internally within the pickup module to destroy pickups.
Destroys a Pickupable.
If the Pickupable is already in the process of being destroyed a warning is displayed and this method is skipped.
bool orxonox::Pickupable::drop | ( | bool | createSpawner = true | ) |
Can be called to drop a Pickupable.
createSpawner | If true a spawner is to be created for the dropped Pickupable. True is default. |
|
inline |
Get the carrier of the Pickupable.
|
pure virtual |
Returns the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup.
Implemented in orxonox::Pickup, and orxonox::PickupCollection.
|
inlineprotected |
Check whether the Pickupable is in the process of being destroyed.
|
inline |
Returns whether the Pickupable is enabled.
Once a Pickupable is disabled it cannot be enabled again. A Pickupable that is disabled can neither be used nor unused.
|
inline |
Returns whether the Pickupable is currently picked up.
|
virtual |
Get whether the given PickupCarrier is a target of this Pickupable.
carrier | The PickupCarrier of which it has to be determinde whether it is a target of this Pickupable. |
Reimplemented in orxonox::PickupCollection.
bool orxonox::Pickupable::isTarget | ( | const Identifier * | identifier | ) | const |
Get whether a given class, represented by the input Identifier, is a target of this Pickupable.
Get whether the given Identififer is a target of this Pickupable.
identifier | The PickupCarrier of which it has to be determinde whether it is a target of this Pickupable. |
|
inline |
Returns whether the Pickupable can be unused.
|
inline |
Returns whether the Pickupable can be used.
|
inline |
Get whether the Pickupable is currently in use or not.
bool orxonox::Pickupable::pickup | ( | PickupCarrier * | carrier | ) |
Can be called to pick up a Pickupable.
carrier | A pointer to the PickupCarrier that picks up the Pickupable. |
A method that is called by Destroyable::destroy() before the object is actually destroyed.
Reimplemented from orxonox::Destroyable.
|
overridevirtual |
Method to transcribe a Pickupable as a Rewardable to the player.
player | A pointer to the PlayerInfo, do whatever you want with it. |
Implements orxonox::Rewardable.
bool orxonox::Pickupable::setCarrier | ( | orxonox::PickupCarrier * | carrier, |
bool | tell = true |
||
) |
Sets the carrier of the Pickupable.
carrier | Sets the input PickupCarrier as the carrier of the pickup. |
tell | If true (default) the pickup is added to the list of pickups in the PickupCarrier. |
bool orxonox::Pickupable::setPickedUp | ( | bool | pickedUp | ) |
Helper method to set the Pickupable to either picked up or not picked up.
pickedUp | The value this->pickedUp_ should be set to. |
bool orxonox::Pickupable::setUsed | ( | bool | used | ) |
Sets the Pickupable to used or unused, depending on the input.
used | If used is true the Pickupable is set to used, it is set to unused, otherwise. |
|
friend |
|
private |
Is true if the Pickupable is in the process of being destroyed.
|
private |
The PickupCarrier of the Pickupable.
|
private |
Whether the Pickupable is enabled or not.
|
private |
Whether the Pickupable is currently picked up or not.
|
private |
The possible targets of this Pickupable.
|
private |
Whether the Pickupable is currently in use or not.