Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
orxonox::Pickupable Class Referenceabstract

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>

Inheritance diagram for orxonox::Pickupable:
orxonox::OrxonoxInterface orxonox::Rewardable orxonox::Configurable orxonox::Destroyable orxonox::OrxonoxInterface orxonox::Listable orxonox::Configurable orxonox::Destroyable orxonox::Identifiable orxonox::Listable orxonox::Identifiable orxonox::CollectiblePickup orxonox::Pickup orxonox::PickupCollection orxonox::BoostPickup orxonox::DamageBoostPickup orxonox::DronePickup orxonox::HealthPickup orxonox::InvisiblePickup orxonox::MetaPickup orxonox::MunitionPickup orxonox::ShieldPickup orxonox::ShrinkPickup orxonox::SpeedPickup

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...
 
PickupCarriergetCarrier (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...
 
ContextgetContext () 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 voidgetDerivedPointer (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...
 
IdentifiergetIdentifier () 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...
 
PickupCarriercarrier_
 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
 

Detailed Description

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.

Author
Damian 'Mozork' Frick

Constructor & Destructor Documentation

orxonox::Pickupable::Pickupable ( )
protected

Default constructor.

Constructor.

Registers the objects and initializes its member variables.

orxonox::Pickupable::~Pickupable ( )
virtual

Default destructor.

Destructor.

Member Function Documentation

bool orxonox::Pickupable::addTarget ( PickupCarrier target)

Add a PickupCarrier as target of this Pickupable.

Parameters
targetThe PickupCarrier to be added.
Returns
Returns true if the target was added, false if not.
bool orxonox::Pickupable::addTarget ( Identifier target)

Add a class, representetd by the input Identifier, as target of this Pickupable.

Parameters
targetThe Identifier to be added.
Returns
Returns true if the target was added, false if not.
void orxonox::Pickupable::carrierDestroyed ( void  )
protectedvirtual

Is called by the PickupCarrier when it is being destroyed.

virtual void orxonox::Pickupable::changedCarrier ( void  )
inlinevirtual

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.

virtual void orxonox::Pickupable::changedPickedUp ( void  )
inlinevirtual

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.

virtual void orxonox::Pickupable::changedUsed ( void  )
inlinevirtual

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.

virtual bool orxonox::Pickupable::createSpawner ( void  )
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.

Returns
Returns true if a spawner was created, false if not.

Implemented in orxonox::Pickup, and orxonox::PickupCollection.

void orxonox::Pickupable::destroy ( void  )

Is called internally within the Pickupable module to destroy pickups.

Is called internally within the pickup module to destroy pickups.

void orxonox::Pickupable::destroyPickup ( void  )
protectedvirtual

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.

Parameters
createSpawnerIf true a spawner is to be created for the dropped Pickupable. True is default.
Returns
Returns true if the Pickupable has been dropped, false if not.
PickupCarrier* orxonox::Pickupable::getCarrier ( void  )
inline

Get the carrier of the Pickupable.

Returns
Returns a pointer to the carrier of the Pickupable.
virtual const std::string& orxonox::Pickupable::getRepresentationName ( ) const
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.

bool orxonox::Pickupable::isBeingDestroyed ( void  )
inlineprotected

Check whether the Pickupable is in the process of being destroyed.

Returns
Returns true if so.
bool orxonox::Pickupable::isEnabled ( void  ) const
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.

Returns
Returns true if the Pickupable is enabled.
bool orxonox::Pickupable::isPickedUp ( void  ) const
inline

Returns whether the Pickupable is currently picked up.

Returns
Returns true if the Pickupable is currently picked up, false if not.
bool orxonox::Pickupable::isTarget ( const PickupCarrier carrier) const
virtual

Get whether the given PickupCarrier is a target of this Pickupable.

Parameters
carrierThe PickupCarrier of which it has to be determinde whether it is a target of this Pickupable.
Returns
Returns true if the given PickupCarrier is a target.

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.

Parameters
identifierThe PickupCarrier of which it has to be determinde whether it is a target of this Pickupable.
Returns
Returns true if the given PickupCarrier is a target.
bool orxonox::Pickupable::isUnusable ( void  ) const
inline

Returns whether the Pickupable can be unused.

Returns
Returns true if it can be unused.
bool orxonox::Pickupable::isUsable ( void  ) const
inline

Returns whether the Pickupable can be used.

Returns
Returns true if it can be used.
bool orxonox::Pickupable::isUsed ( void  ) const
inline

Get whether the Pickupable is currently in use or not.

Returns
Returns true if the Pickupable is currently in use.
bool orxonox::Pickupable::pickup ( PickupCarrier carrier)

Can be called to pick up a Pickupable.

Parameters
carrierA pointer to the PickupCarrier that picks up the Pickupable.
Returns
Returns true if the Pickupable was picked up, false if not.
void orxonox::Pickupable::preDestroy ( void  )
overrideprotectedvirtual

A method that is called by Destroyable::destroy() before the object is actually destroyed.

Reimplemented from orxonox::Destroyable.

bool orxonox::Pickupable::reward ( PlayerInfo player)
overridevirtual

Method to transcribe a Pickupable as a Rewardable to the player.

Parameters
playerA pointer to the PlayerInfo, do whatever you want with it.
Returns
Return true if successful.

Implements orxonox::Rewardable.

bool orxonox::Pickupable::setCarrier ( orxonox::PickupCarrier carrier,
bool  tell = true 
)

Sets the carrier of the Pickupable.

Parameters
carrierSets the input PickupCarrier as the carrier of the pickup.
tellIf true (default) the pickup is added to the list of pickups in the PickupCarrier.
Returns
Returns true if successful, false if not.
void orxonox::Pickupable::setDisabled ( void  )
inlineprotected

Sets the Pickuapble to disabled.

bool orxonox::Pickupable::setPickedUp ( bool  pickedUp)

Helper method to set the Pickupable to either picked up or not picked up.

Parameters
pickedUpThe value this->pickedUp_ should be set to.
Returns
Returns true if the pickedUp status was changed, false if not.
bool orxonox::Pickupable::setUsed ( bool  used)

Sets the Pickupable to used or unused, depending on the input.

Parameters
usedIf used is true the Pickupable is set to used, it is set to unused, otherwise.
Returns
Returns true if the used state was changed, false if not.

Friends And Related Function Documentation

friend class PickupCarrier
friend

Member Data Documentation

bool orxonox::Pickupable::beingDestroyed_
private

Is true if the Pickupable is in the process of being destroyed.

PickupCarrier* orxonox::Pickupable::carrier_
private
bool orxonox::Pickupable::enabled_
private

Whether the Pickupable is enabled or not.

bool orxonox::Pickupable::pickedUp_
private

Whether the Pickupable is currently picked up or not.

std::list<Identifier*> orxonox::Pickupable::targets_
private

The possible targets of this Pickupable.

bool orxonox::Pickupable::used_
private

Whether the Pickupable is currently in use or not.


The documentation for this class was generated from the following files: