Class GameControllerVs

java.lang.Object
com.edu.xmum.CST210.Controller.GameControllerVs
All Implemented Interfaces:
IGameController

public class GameControllerVs extends Object implements 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 Details

    • GameControllerVs

      public GameControllerVs(IGameService gameService)
      Constructor to initialize the game service.
      Parameters:
      gameService - The game service managing game logic.
  • Method Details

    • startGame

      public void startGame()
      Description copied from interface: IGameController
      Starts the game by initializing necessary components and setting up the initial state.
      Specified by:
      startGame in interface IGameController
    • resetGame

      public void resetGame()
      Description copied from interface: IGameController
      Resets the game to its initial state.
      Specified by:
      resetGame in interface IGameController
    • getDifficulty

      public String getDifficulty()
      Description copied from interface: IGameController
      Gets the current difficulty level of the game.
      Specified by:
      getDifficulty in interface IGameController
      Returns:
      The current difficulty level.
    • setDifficulty

      public void setDifficulty(String difficulty)
      Description copied from interface: IGameController
      Sets the difficulty level of the game.
      Specified by:
      setDifficulty in interface IGameController
      Parameters:
      difficulty - The difficulty level to set (e.g., Easy, Medium, Hard).
    • handleKeyPress

      public void handleKeyPress(String key)
      Description copied from interface: IGameController
      Handles key press events to control game actions.
      Specified by:
      handleKeyPress in interface IGameController
      Parameters:
      key - The key pressed by the user.
    • showSelectionView

      public void showSelectionView()
      Description copied from interface: IGameController
      Displays the selection view where users can choose game settings.
      Specified by:
      showSelectionView in interface IGameController
    • showPrepareView

      public void showPrepareView()
      Description copied from interface: IGameController
      Displays the preparation view before starting the game.
      Specified by:
      showPrepareView in interface IGameController
    • showRunView

      public void showRunView()
      Description copied from interface: IGameController
      Displays the main game view where the game is played.
      Specified by:
      showRunView in interface IGameController
    • showVictoryView

      public void showVictoryView(String winner)
      Description copied from interface: IGameController
      Displays the victory view when the player wins the game.
      Specified by:
      showVictoryView in interface IGameController
      Parameters:
      winner - The winner of the game.
    • showHint

      public void showHint()
      Description copied from interface: IGameController
      Displays a hint to the player during the game.
      Specified by:
      showHint in interface IGameController
    • startAiMovement

      public void startAiMovement()
      Description copied from interface: IGameController
      Starts the AI movement in the game.
      Specified by:
      startAiMovement in interface IGameController
    • showFailureView

      public void showFailureView()
      Description copied from interface: IGameController
      Displays the failure view when the player loses the game.
      Specified by:
      showFailureView in interface IGameController
    • getGameService

      public IGameService getGameService()
      Description copied from interface: IGameController
      Gets the game service, which handles game logic and operations.
      Specified by:
      getGameService in interface IGameController
      Returns:
      The game service.
    • getGameView

      public IGameView getGameView()
    • setGameView

      public void setGameView(IGameView gameView)
      Description copied from interface: IGameController
      Sets the game view, which is responsible for the user interface.
      Specified by:
      setGameView in interface IGameController
      Parameters:
      gameView - The game view to set.