PCG-FPS  v2 m0.22.4
Simple First Person Shooter with Procedurally Generated Level
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
skr::fps2::Game::Game Class Reference

Main Game Manager class keeps track of status of game (started, finished, completed) and stats (number of shots, hits, etc). More...

#include <Game.h>

Public Member Functions

void AddTarget (uint32_t target)
 adds target of given id to list of targets More...
 
void Shot ()
 called if a shot is fired (LMB press) More...
 
void Hit (uint32_t id)
 called if a hit is registered More...
 
void Reset ()
 resets game clears targets and resets all flags and stats to initial values More...
 
void ResetStats ()
 resets stats More...
 
bool IsComplete ()
 returns value inidcating if all targets are not or not More...
 
std::string GetStats ()
 gets current stats in human readable form More...
 
void Start ()
 called if game is startet: player crosses the start line More...
 
void Finish ()
 called if game finished: player reaches the finish box More...
 
bool IsFinished ()
 returns value inidicating if game is finished More...
 
bool IsStarted ()
 returns a value indcating if game has started More...
 
bool IsRunning ()
 returns a value indicating if game is running More...
 

Static Public Member Functions

static GameGetInstance ()
 gets only instance of Game manager Implements Scott Meyer's singleton pattern More...
 

Public Attributes

std::vector< Completed_targets
 list of target ids and completion status More...
 
uint32_t _numberOfShots
 number of shots fired by the plaer More...
 
uint32_t _numberOfHits
 number of hits registered More...
 

Private Member Functions

 Game ()
 default constructor resets stats More...
 
 Game (const Game &)=delete
 copy constructor is deleted More...
 
Game operator= (const Game &)=delete
 copy assignment operator is deleted More...
 
uint32_t NumberOfCompeltedTargets ()
 returns number of completed targets More...
 

Private Attributes

bool _started
 flag inidacting if game ist startet More...
 
bool _finished
 flat inidicating if finish is reached More...
 
bool _complete
 flag inidication if game is completed More...
 
std::chrono::system_clock::time_point _startTime
 recoreded time of player crossing the start line More...
 
std::chrono::system_clock::time_point _finishTime
 recoreded time of player reaching the finish box More...
 

Detailed Description

Main Game Manager class keeps track of status of game (started, finished, completed) and stats (number of shots, hits, etc).

Implements Scott Meyers' singleton pattern.

Constructor & Destructor Documentation

◆ Game() [1/2]

skr::fps2::Game::Game::Game ( )
inlineprivate

default constructor resets stats

◆ Game() [2/2]

skr::fps2::Game::Game::Game ( const Game )
privatedelete

copy constructor is deleted

Member Function Documentation

◆ AddTarget()

void skr::fps2::Game::Game::AddTarget ( uint32_t  target)

adds target of given id to list of targets

Parameters
targetid of target

◆ Finish()

void skr::fps2::Game::Game::Finish ( )

called if game finished: player reaches the finish box

◆ GetInstance()

Game & skr::fps2::Game::Game::GetInstance ( )
static

gets only instance of Game manager Implements Scott Meyer's singleton pattern

Returns
reference to only instance of this class

◆ GetStats()

std::string skr::fps2::Game::Game::GetStats ( )

gets current stats in human readable form

Returns
string of current stats in human readable form

◆ Hit()

void skr::fps2::Game::Game::Hit ( uint32_t  id)

called if a hit is registered

Parameters
idof target hit

◆ IsComplete()

bool skr::fps2::Game::Game::IsComplete ( )

returns value inidcating if all targets are not or not

Returns
true if all targets are hit, otherwise false

◆ IsFinished()

bool skr::fps2::Game::Game::IsFinished ( )

returns value inidicating if game is finished

Returns
true if finished, otherwise false

◆ IsRunning()

bool skr::fps2::Game::Game::IsRunning ( )

returns a value indicating if game is running

Returns
true if IsStarted() and not IsFinished(), otherwise false

◆ IsStarted()

bool skr::fps2::Game::Game::IsStarted ( )

returns a value indcating if game has started

Returns
true if game is started, otherwise false

◆ NumberOfCompeltedTargets()

uint32_t skr::fps2::Game::Game::NumberOfCompeltedTargets ( )
private

returns number of completed targets

Returns
number of completed targets

◆ operator=()

Game skr::fps2::Game::Game::operator= ( const Game )
privatedelete

copy assignment operator is deleted

◆ Reset()

void skr::fps2::Game::Game::Reset ( )

resets game clears targets and resets all flags and stats to initial values

◆ ResetStats()

void skr::fps2::Game::Game::ResetStats ( )

resets stats

◆ Shot()

void skr::fps2::Game::Game::Shot ( )

called if a shot is fired (LMB press)

◆ Start()

void skr::fps2::Game::Game::Start ( )

called if game is startet: player crosses the start line

Member Data Documentation

◆ _complete

bool skr::fps2::Game::Game::_complete
private

flag inidication if game is completed

◆ _finished

bool skr::fps2::Game::Game::_finished
private

flat inidicating if finish is reached

◆ _finishTime

std::chrono::system_clock::time_point skr::fps2::Game::Game::_finishTime
private

recoreded time of player reaching the finish box

◆ _numberOfHits

uint32_t skr::fps2::Game::Game::_numberOfHits

number of hits registered

◆ _numberOfShots

uint32_t skr::fps2::Game::Game::_numberOfShots

number of shots fired by the plaer

◆ _started

bool skr::fps2::Game::Game::_started
private

flag inidacting if game ist startet

◆ _startTime

std::chrono::system_clock::time_point skr::fps2::Game::Game::_startTime
private

recoreded time of player crossing the start line

◆ _targets

std::vector<Completed> skr::fps2::Game::Game::_targets

list of target ids and completion status


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