Pac-Man
Public Member Functions | List of all members
CGameInfo Class Reference

Class that holds info about current played game. More...

#include <CGameInfo.h>

Collaboration diagram for CGameInfo:
Collaboration graph

Public Member Functions

 CGameInfo (uint32_t time, SGameParameters gameParameters, unsigned int numberOfBonuses)
 Constructs new game info to a new game. More...
 
void bonusWasPicked (const SGameObjectInfo &objectInfo)
 The method by which game info is informed about collecting the bonus. More...
 
void updateTime (uint32_t time)
 Updates timer in the game info. More...
 
bool generateMovingBonus ()
 Returns info if the moving bonus should be generated. When true, then moving bonus have to be generated. More...
 
void ghostWasKilled ()
 Updates current game nfo of the game by information that ghost was killed.
 
void playerWasKilled ()
 Updates current game nfo of the game by information that player was killed.
 
void reset ()
 resets the game info for a new game with the same parameters
 
void movingBonusWasPicked ()
 The method by which game info is informed about collecting the moving bonus.
 
float calcGhostSpeed () const
 Method calc's ghost speed. More...
 
float calcPlayerSpeed () const
 Method calc's player speed. More...
 
float calcMovingBonusSpeed () const
 Method calc's moving bonus speed. More...
 
void getDisplayInfo (SDisplayInfo &toFill) const
 Method fills info about the game. More...
 
float getPickedBonusesRatio () const
 Returns (already picked bonuses) / (bonuses on the beginning of the game) More...
 
EGameState getGameState () const
 Returns current game state. More...
 
uint32_t getTime () const
 Returns current time in the game info. More...
 

Detailed Description

Class that holds info about current played game.

Constructor & Destructor Documentation

◆ CGameInfo()

CGameInfo::CGameInfo ( uint32_t  time,
SGameParameters  gameParameters,
unsigned int  numberOfBonuses 
)

Constructs new game info to a new game.

Parameters
[in]timetime from the start of the game
[in]gameParametersparameters of the game, which would be played
[in]numberOfBonusesnumber of all static (non-moving) bonuses at the start of the game

Member Function Documentation

◆ bonusWasPicked()

void CGameInfo::bonusWasPicked ( const SGameObjectInfo objectInfo)

The method by which game info is informed about collecting the bonus.

Parameters
[in]objectInfoinformation about the picked bonus

◆ calcGhostSpeed()

float CGameInfo::calcGhostSpeed ( ) const

Method calc's ghost speed.

Returns
distance ghost can travel during one move (distance is measured as one between two tiles)

◆ calcMovingBonusSpeed()

float CGameInfo::calcMovingBonusSpeed ( ) const

Method calc's moving bonus speed.

Returns
distance moving bonus can travel during one move (distance is measured as one between two tiles)

◆ calcPlayerSpeed()

float CGameInfo::calcPlayerSpeed ( ) const

Method calc's player speed.

Returns
distance player can travel during one move (distance is measured as one between two tiles)

◆ generateMovingBonus()

bool CGameInfo::generateMovingBonus ( )

Returns info if the moving bonus should be generated. When true, then moving bonus have to be generated.

Returns
if the moving bonus have to be generated

◆ getDisplayInfo()

void CGameInfo::getDisplayInfo ( SDisplayInfo toFill) const

Method fills info about the game.

Parameters
[out]toFillstructure where the information about the game which should be displayed will be saved

◆ getGameState()

EGameState CGameInfo::getGameState ( ) const

Returns current game state.

Returns
State of the game is returned.

◆ getPickedBonusesRatio()

float CGameInfo::getPickedBonusesRatio ( ) const

Returns (already picked bonuses) / (bonuses on the beginning of the game)

Returns
value between 0 - 1

◆ getTime()

uint32_t CGameInfo::getTime ( ) const

Returns current time in the game info.

Returns
time from the start of the game

◆ updateTime()

void CGameInfo::updateTime ( uint32_t  time)

Updates timer in the game info.

Parameters
[in]timetime from the start of the game

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