Package controller
Class GameController
java.lang.Object
controller.GameController
- All Implemented Interfaces:
IGameController
GameController handles communication between the Engine and the GUI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IEnginethe game engineprivate final FXIGameControllerthe GUI controller -
Constructor Summary
ConstructorsConstructorDescriptionGameController(FXIGameController fxiGameController) Constructor for GameController -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidgameOver(boolean victory) sends the game over signal to the GUIvoidgetActive(int id) intreturns the difficulty of the gamegetGrade()returns the grade of the gamevoidvoidvoidsendIdToEngine(int id) sends the id of the clicked cube to the enginevoidsetGame(ArrayList<MemoryObject> memoryObjects) voidsetTimer(int i) voidshowHint()voidstarts the gamevoidvoidupdateDynamicScore(int score)
-
Field Details
-
fxiGameController
the GUI controller -
engine
the game engine
-
-
Constructor Details
-
GameController
Constructor for GameController- Parameters:
fxiGameController- the GUI controller
-
-
Method Details
-
startGame
starts the game- Specified by:
startGamein interfaceIGameController- Parameters:
type- the difficulty of the game
-
sendIdToEngine
public void sendIdToEngine(int id) sends the id of the clicked cube to the engine- Specified by:
sendIdToEnginein interfaceIGameController- Parameters:
id- the id of the clicked cube
-
clearStorage
public void clearStorage()- Specified by:
clearStoragein interfaceIGameController
-
killTimer
public void killTimer()- Specified by:
killTimerin interfaceIGameController
-
clearPair
- Specified by:
clearPairin interfaceIGameController
-
setGame
- Specified by:
setGamein interfaceIGameController
-
gameOver
public void gameOver(boolean victory) sends the game over signal to the GUI- Specified by:
gameOverin interfaceIGameController- Parameters:
victory- true if the player won, false if the player lost (timed out)
-
getActive
public void getActive(int id) - Specified by:
getActivein interfaceIGameController
-
setTimer
public void setTimer(int i) - Specified by:
setTimerin interfaceIGameController
-
showHint
public void showHint()- Specified by:
showHintin interfaceIGameController
-
sendComparingSuccess
public void sendComparingSuccess()- Specified by:
sendComparingSuccessin interfaceIGameController
-
getCurrentScore
public int getCurrentScore()- Specified by:
getCurrentScorein interfaceIGameController
-
getDifficulty
returns the difficulty of the game- Specified by:
getDifficultyin interfaceIGameController- Returns:
- the difficulty of the game
-
getGrade
returns the grade of the game- Specified by:
getGradein interfaceIGameController- Returns:
- the grade of the game
-
updateDynamicScore
public void updateDynamicScore(int score) - Specified by:
updateDynamicScorein interfaceIGameController
-
startTime
public void startTime()- Specified by:
startTimein interfaceIGameController
-