Bubble Class Reference

Bubble in the game. More...

#include <bubble.h>

Inheritance diagram for Bubble:

TimeUpdateable GraphicalNode Templates::CallableBack< Explosion >

List of all members.

Public Member Functions

 Bubble (const SbColor &color, Explosion *explosion)
 Public constructor.
 ~Bubble ()
 Destructor.
virtual void timeUpdate (float dt)
 Timer value change event occured.
virtual void callableBackNotify (Explosion *subject)
 Subject performed action on which the callback was defined.
Bubbleclone () const
 Clones this bubble.
void setMotionVector (const SbVec3f &newMotionVector)
 Sets motion vector.
const SbVec3f & getMotionVector () const
 Gets motion vector.
void setPosition (const SbVec3f &newPosition)
 Sets new position.
const SbVec3f & getPosition () const
 Gets position.
int getType ()
 Returns type of the bubble.
bool collidesWithBubble (const SbVec3f &other) const
 Returns true if the Bubble collides with other Bubble.
virtual void enableTransparency ()
 Makes the bubble transparent.
virtual void disableTransparency ()
 Makes the bubble solid.
void explode (Templates::CallableBack< Bubble > *explodeDone)
 Explodes the bubble.

Static Public Member Functions

static float getSpeed ()
 Gets speed of the bubbles.
static float getRadius ()
 Gets radius of all bubbles.

Private Member Functions

 Bubble (int id, const SbColor &color, Explosion *explosion)
 Private constructor.
void createOIGraph ()
 Creates OI objects and add them to the SoSeparator.

Private Attributes

int _typeId
 Id that identifies the type of the bubble.
SbVec3f _motionVector
 Motion vector (unit vector).
SoTranslation * _position
 Position (point is represented by vector).
SbColor _color
 Diffuse color of the bubble.
Explosion_explosion
 Explosion effect.
Templates::CallableBack< Bubble > * _explodeDone
SoMaterial * _material
 The material of the bubble.

Static Private Attributes

static const float TRANSPARENCY_TRANSPARENT
 Transparency value of a transparent bubble.
static const float TRANSPARENCY_SOLID
 Transparency value of a solid bubble.
static int freeTypeId
 Stores first free number than identifies types of bubble.
static float speed
 Basic speed of the bubble.


Detailed Description

Bubble in the game.

Bubble can have its own color and can be static or moving


Constructor & Destructor Documentation

Bubble::Bubble ( int  id,
const SbColor &  color,
Explosion explosion 
) [private]

Private constructor.

Parameters:
[in] id Identifies type of the bubble
[in] color Color of the bubble
[in] explosion Explosion effect

Bubble::Bubble ( const SbColor &  color,
Explosion explosion 
)

Public constructor.

Parameters:
[in] color Color of the bubble
[in] explosion Explosion effect
Creates new type of bubble. You should use clone() in most cases instead

Bubble::~Bubble (  ) 

Destructor.


Member Function Documentation

void Bubble::createOIGraph (  )  [private]

Creates OI objects and add them to the SoSeparator.

This method can be called only once (in the constructor)

virtual void Bubble::timeUpdate ( float  dt  )  [virtual]

Timer value change event occured.

This method is called on each timer value change.

Parameters:
[in] dt Time difference between the last call (delta).

Implements TimeUpdateable.

virtual void Bubble::callableBackNotify ( Explosion subject  )  [virtual]

Subject performed action on which the callback was defined.

Parameters:
[in] subject Object that perfmored the action.

Implements Templates::CallableBack< Explosion >.

Bubble* Bubble::clone (  )  const

Clones this bubble.

Returns:
Returns pointer to a new alloced exact copy of itself

void Bubble::setMotionVector ( const SbVec3f &  newMotionVector  ) 

Sets motion vector.

Given vector is transformed to unit vector before the assignment

Parameters:
[in] newMotionVector New motion vector

const SbVec3f& Bubble::getMotionVector (  )  const [inline]

Gets motion vector.

Returns:
Motion vector

References _motionVector.

void Bubble::setPosition ( const SbVec3f &  newPosition  )  [inline]

Sets new position.

Parameters:
[in] newPosition Vector which determines new position of the bubble

References _position.

const SbVec3f& Bubble::getPosition (  )  const [inline]

Gets position.

Returns:
Position of the bubble

References _position.

static float Bubble::getSpeed (  )  [inline, static]

Gets speed of the bubbles.

Returns:
Speed of the bubbles

References speed.

static float Bubble::getRadius (  )  [inline, static]

Gets radius of all bubbles.

Returns:
Radius of the bubbles

References BubbleField::getNumberOfBubblesInRow(), and PlayField::getSizeHalfSize().

int Bubble::getType (  )  [inline]

Returns type of the bubble.

References _typeId.

bool Bubble::collidesWithBubble ( const SbVec3f &  other  )  const

Returns true if the Bubble collides with other Bubble.

Parameters:
[in] other Position of other bubble

virtual void Bubble::enableTransparency (  )  [virtual]

Makes the bubble transparent.

virtual void Bubble::disableTransparency (  )  [virtual]

Makes the bubble solid.

void Bubble::explode ( Templates::CallableBack< Bubble > *  explodeDone  ) 

Explodes the bubble.

Parameters:
[in] explodeDone Object on which the "action performed" method should be called when the bubble has exploded


Member Data Documentation

const float Bubble::TRANSPARENCY_TRANSPARENT [static, private]

Transparency value of a transparent bubble.

const float Bubble::TRANSPARENCY_SOLID [static, private]

Transparency value of a solid bubble.

int Bubble::freeTypeId [static, private]

Stores first free number than identifies types of bubble.

float Bubble::speed [static, private]

Basic speed of the bubble.

Referenced by getSpeed().

int Bubble::_typeId [private]

Id that identifies the type of the bubble.

Referenced by getType().

SbVec3f Bubble::_motionVector [private]

Motion vector (unit vector).

Referenced by getMotionVector().

SoTranslation* Bubble::_position [private]

Position (point is represented by vector).

Referenced by getPosition(), and setPosition().

SbColor Bubble::_color [private]

Diffuse color of the bubble.

Explosion effect.

Object on which the "action performed" method should be called when the explosion is completed

SoMaterial* Bubble::_material [private]

The material of the bubble.


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

Generated on Sat Dec 20 19:21:24 2008 for PGR2008 by  doxygen 1.5.6