Package com.edu.xmum.CST210.Controller
Class GameControllerVs
java.lang.Object
com.edu.xmum.CST210.Controller.GameControllerVs
- All Implemented Interfaces:
IGameController
Controller class for a two-player game mode.
This class is responsible for managing game logic, handling user inputs,
and updating the game state and view accordingly.
-
Constructor Summary
ConstructorsConstructorDescriptionGameControllerVs(IGameService gameService) Constructor to initialize the game service. -
Method Summary
Modifier and TypeMethodDescriptionGets the current difficulty level of the game.Gets the game service, which handles game logic and operations.voidhandleKeyPress(String key) Handles key press events to control game actions.voidResets the game to its initial state.voidsetDifficulty(String difficulty) Sets the difficulty level of the game.voidsetGameView(IGameView gameView) Sets the game view, which is responsible for the user interface.voidDisplays the failure view when the player loses the game.voidshowHint()Displays a hint to the player during the game.voidDisplays the preparation view before starting the game.voidDisplays the main game view where the game is played.voidDisplays the selection view where users can choose game settings.voidshowVictoryView(String winner) Displays the victory view when the player wins the game.voidStarts the AI movement in the game.voidStarts the game by initializing necessary components and setting up the initial state.
-
Constructor Details
-
GameControllerVs
Constructor to initialize the game service.- Parameters:
gameService- The game service managing game logic.
-
-
Method Details
-
startGame
public void startGame()Description copied from interface:IGameControllerStarts the game by initializing necessary components and setting up the initial state.- Specified by:
startGamein interfaceIGameController
-
resetGame
public void resetGame()Description copied from interface:IGameControllerResets the game to its initial state.- Specified by:
resetGamein interfaceIGameController
-
getDifficulty
Description copied from interface:IGameControllerGets the current difficulty level of the game.- Specified by:
getDifficultyin interfaceIGameController- Returns:
- The current difficulty level.
-
setDifficulty
Description copied from interface:IGameControllerSets the difficulty level of the game.- Specified by:
setDifficultyin interfaceIGameController- Parameters:
difficulty- The difficulty level to set (e.g., Easy, Medium, Hard).
-
handleKeyPress
Description copied from interface:IGameControllerHandles key press events to control game actions.- Specified by:
handleKeyPressin interfaceIGameController- Parameters:
key- The key pressed by the user.
-
showSelectionView
public void showSelectionView()Description copied from interface:IGameControllerDisplays the selection view where users can choose game settings.- Specified by:
showSelectionViewin interfaceIGameController
-
showPrepareView
public void showPrepareView()Description copied from interface:IGameControllerDisplays the preparation view before starting the game.- Specified by:
showPrepareViewin interfaceIGameController
-
showRunView
public void showRunView()Description copied from interface:IGameControllerDisplays the main game view where the game is played.- Specified by:
showRunViewin interfaceIGameController
-
showVictoryView
Description copied from interface:IGameControllerDisplays the victory view when the player wins the game.- Specified by:
showVictoryViewin interfaceIGameController- Parameters:
winner- The winner of the game.
-
showHint
public void showHint()Description copied from interface:IGameControllerDisplays a hint to the player during the game.- Specified by:
showHintin interfaceIGameController
-
startAiMovement
public void startAiMovement()Description copied from interface:IGameControllerStarts the AI movement in the game.- Specified by:
startAiMovementin interfaceIGameController
-
showFailureView
public void showFailureView()Description copied from interface:IGameControllerDisplays the failure view when the player loses the game.- Specified by:
showFailureViewin interfaceIGameController
-
getGameService
Description copied from interface:IGameControllerGets the game service, which handles game logic and operations.- Specified by:
getGameServicein interfaceIGameController- Returns:
- The game service.
-
getGameView
-
setGameView
Description copied from interface:IGameControllerSets the game view, which is responsible for the user interface.- Specified by:
setGameViewin interfaceIGameController- Parameters:
gameView- The game view to set.
-