Bandidos
Public Member Functions | List of all members
com.mygdx.game.score.ScoreSystem Class Reference
Inheritance diagram for com.mygdx.game.score.ScoreSystem:
com.mygdx.game.score.GameScoreSystem

Public Member Functions

 ScoreSystem ()
 
int addScore (int score)
 
int subScore (int score)
 
int getMultiplier ()
 
void setMultiplier (int value)
 
int getScore ()
 
int getBestScore ()
 
int getBestMultiplier ()
 
void endScoreSession (boolean saveIfBest)
 
boolean isBestSession ()
 
void resetBestData ()
 
void loadBestData ()
 
void saveBestData ()
 

Detailed Description

This a class which can be used to track score and save / load highscore data.

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ ScoreSystem()

com.mygdx.game.score.ScoreSystem.ScoreSystem ( )

Instantiates the ScoreSystem, loads the last best score data and starts a new score session

Member Function Documentation

◆ addScore()

int com.mygdx.game.score.ScoreSystem.addScore ( int  score)

Adds Score to the current score session. If the current score reaches higher than the best score, it becomes the best score (Not saved)

Parameters
scoreto add * the current multiplier to the current score.
Returns
real score added

◆ endScoreSession()

void com.mygdx.game.score.ScoreSystem.endScoreSession ( boolean  saveIfBest)

Ends the current score session and resets all current score values.

Parameters
saveIfBestsaves the best score data into the device if it was reached by this session

◆ getBestMultiplier()

int com.mygdx.game.score.ScoreSystem.getBestMultiplier ( )

Gets the best multiplier session If the current multiplier > than the saved best multiplier, it becomes the new one and thus is returned by this method

Returns
The best multiplier session

◆ getBestScore()

int com.mygdx.game.score.ScoreSystem.getBestScore ( )

Gets the best score session. If the current score > than the saved best score, it becomes the new one and thus is returned by this method

Returns
The best score session.

◆ getMultiplier()

int com.mygdx.game.score.ScoreSystem.getMultiplier ( )

Gets the value of the current score multiplier.

Returns
The value of the current multiplier (DEFAULT: 1)

◆ getScore()

int com.mygdx.game.score.ScoreSystem.getScore ( )

Gets the current score.

Returns
The value of the current score.

◆ isBestSession()

boolean com.mygdx.game.score.ScoreSystem.isBestSession ( )

◆ loadBestData()

void com.mygdx.game.score.ScoreSystem.loadBestData ( )

Loads the best score and multiplier data into the current session from the current device.

◆ resetBestData()

void com.mygdx.game.score.ScoreSystem.resetBestData ( )

Resets the device saved data. Call the 'loadBestData' to reset the data loaded before calling this method also.

◆ saveBestData()

void com.mygdx.game.score.ScoreSystem.saveBestData ( )

Saves the current BestScore and BestMultiplier data into the current device.

◆ setMultiplier()

void com.mygdx.game.score.ScoreSystem.setMultiplier ( int  value)

Sets the value of the current score multiplier If the current multiplier > than the saved best multiplier, it becomes the new best multiplier

Parameters
valueto set the current multiplier to.

◆ subScore()

int com.mygdx.game.score.ScoreSystem.subScore ( int  score)

Subtract the given score value from the current score.

Parameters
scoreto subtract * the current multiplier from the current score.
Returns
real score subtracted

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