#include <bubble.h>
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. | |
Bubble * | clone () 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. |
Bubble can have its own color and can be static or moving
Bubble::Bubble | ( | int | id, | |
const SbColor & | color, | |||
Explosion * | explosion | |||
) | [private] |
Private constructor.
[in] | id | Identifies type of the bubble |
[in] | color | Color of the bubble |
[in] | explosion | Explosion effect |
Bubble::Bubble | ( | const SbColor & | color, | |
Explosion * | explosion | |||
) |
Bubble::~Bubble | ( | ) |
Destructor.
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.
[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.
[in] | subject | Object that perfmored the action. |
Implements Templates::CallableBack< Explosion >.
Bubble* Bubble::clone | ( | ) | const |
Clones this bubble.
void Bubble::setMotionVector | ( | const SbVec3f & | newMotionVector | ) |
Sets motion vector.
Given vector is transformed to unit vector before the assignment
[in] | newMotionVector | New motion vector |
const SbVec3f& Bubble::getMotionVector | ( | ) | const [inline] |
void Bubble::setPosition | ( | const SbVec3f & | newPosition | ) | [inline] |
Sets new position.
[in] | newPosition | Vector which determines new position of the bubble |
References _position.
const SbVec3f& Bubble::getPosition | ( | ) | const [inline] |
static float Bubble::getSpeed | ( | ) | [inline, static] |
static float Bubble::getRadius | ( | ) | [inline, static] |
Gets radius of all bubbles.
References BubbleField::getNumberOfBubblesInRow(), and PlayField::getSizeHalfSize().
int Bubble::getType | ( | ) | [inline] |
bool Bubble::collidesWithBubble | ( | const SbVec3f & | other | ) | const |
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.
[in] | explodeDone | Object on which the "action performed" method should be called when the bubble has exploded |
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] |
int Bubble::_typeId [private] |
SbVec3f Bubble::_motionVector [private] |
SoTranslation* Bubble::_position [private] |
SbColor Bubble::_color [private] |
Diffuse color of the bubble.
Explosion* Bubble::_explosion [private] |
Explosion effect.
Templates::CallableBack<Bubble>* Bubble::_explodeDone [private] |
Object on which the "action performed" method should be called when the explosion is completed
SoMaterial* Bubble::_material [private] |
The material of the bubble.