Disc Manager singleton class. More...
#include <DiscManager.h>
Public Member Functions | |
void | CreateDisc () |
void | UpdateDiscsSingleplayer (double deltaTime, Grid *grid) |
CIwFVec2 | UpdateDiscsMultiplayer (double deltaTime, Grid *grid, bool myTurn, CIwFVec2 pos) |
void | CheckGridExteriorCollisions (Disc *disc, Grid *grid, double deltaTime, bool &colliderCollision) |
void | CheckGridInteriorCollisions (Disc *disc, Grid *grid, double deltaTime, bool &discCollision) |
void | DrawDiscs (double deltaTime) |
bool | CanCreateDisc () |
void | DeleteDiscs () |
int | GetCurrentDiscColour () |
bool | GetCurrentDiscLaunched () |
bool | GetCurrentDiscHasLanded () |
bool | GetCurrentDiscHasTarget () |
void | LaunchCurrentDisc (CIwFVec2 velocity) |
Static Public Member Functions | |
static DiscManager * | Instance () |
static void | DestroyInstance () |
Protected Member Functions | |
DiscManager () | |
~DiscManager () | |
Protected Attributes | |
std::vector< Disc * > | m_discs |
Vector of discs being used in the current match. | |
float | m_discSpawnX |
X spawn position of the disc. | |
float | m_discSpawnY |
XY spawn position of the disc. | |
Static Protected Attributes | |
static DiscManager * | m_instance = 0 |
Static DiscManager instance which will be returned when the singleton's Instance() method is called. |
Disc Manager singleton class.
Returns an instance of a disc manager, which can be used to update, create, and draw discs.
DiscManager::DiscManager | ( | ) | [protected] |
Constructor.
Creates a DiscManager object. Protected as this is a singleton, which is created when Instance() is first called.
DiscManager::~DiscManager | ( | ) | [protected] |
Destructor.
Destroys the DiscManager object. Protected as this is a singleton, which should instead be deleted using DestroyInstance().
bool DiscManager::CanCreateDisc | ( | ) |
Can a new disc be created?
Checks if the previous disc has landed. If it has, a new one can be created.
void DiscManager::CheckGridExteriorCollisions | ( | Disc * | disc, | |
Grid * | grid, | |||
double | deltaTime, | |||
bool & | colliderCollision | |||
) |
Check outer grid collisions.
Has a disc collided with the outside of the grid?
[in] | disc | The disc to be checked. |
[in] | grid | The grid. |
[in] | deltaTime | Time since the last update. |
[out] | colliderCollision | Has the disc hit a top collider? Used to check for stuck discs. |
void DiscManager::CheckGridInteriorCollisions | ( | Disc * | disc, | |
Grid * | grid, | |||
double | deltaTime, | |||
bool & | discCollision | |||
) |
Check inner grid collisions.
Has a disc collided with the inside of the grid?
[in] | disc | The disc to be checked. |
[in] | grid | The grid. |
[in] | deltaTime | Time since the last update. |
[out] | discCollision | Has the disc hit the top of a column? Used to check for stuck discs. |
void DiscManager::CreateDisc | ( | ) |
Create a disc.
Create a new disc. Alternates colours between red and yellow.
void DiscManager::DeleteDiscs | ( | ) |
Delete all discs.
Deletes all discs currently in the disc vector and releases all memory .
void DiscManager::DestroyInstance | ( | ) | [static] |
Delete this singleton.
Safely deletes the singleton instance and releases any memory it was using.
void DiscManager::DrawDiscs | ( | double | deltaTime | ) |
Draw discs.
Draw all active discs.
[in] | deltaTime | Time since the last update. |
int DiscManager::GetCurrentDiscColour | ( | ) |
Get current colour.
Get the colour of the current disc.
bool DiscManager::GetCurrentDiscHasLanded | ( | ) |
Get current has landed.
Get whether the current disc has landed in the grid.
bool DiscManager::GetCurrentDiscHasTarget | ( | ) |
Get current target.
Get whether the current disc has been assigned a target yet. Used for multiplayer updates.
bool DiscManager::GetCurrentDiscLaunched | ( | ) |
Get current has launched.
Has the current disc been launched yet?
DiscManager * DiscManager::Instance | ( | ) | [static] |
Return the static DiscManager instance.
Returns a static instance of DiscManager. If no DiscManager instance exists, one is created.
void DiscManager::LaunchCurrentDisc | ( | CIwFVec2 | velocity | ) |
Launch disc.
Launches the current disc.
[in] | velocity | Initial launch velocity. |
CIwFVec2 DiscManager::UpdateDiscsMultiplayer | ( | double | deltaTime, | |
Grid * | grid, | |||
bool | myTurn, | |||
CIwFVec2 | pos | |||
) |
Multiplayer update.
Update the discs for a multiplayer game.
[in] | deltaTime | Time since the last update. |
[in] | grid | Game grid. |
[in] | myTurn | Is it my turn? |
[in] | pos | Position of the other player's disc (if it is their turn). |
void DiscManager::UpdateDiscsSingleplayer | ( | double | deltaTime, | |
Grid * | grid | |||
) |
Singleplayer update.
Update the discs for a singleplayer game.
[in] | deltaTime | Time since the last update. |
[in] | grid | Game grid. |