Class LineCountLayer

java.lang.Object
sac.model.gamemodes.LineCountLayer
All Implemented Interfaces:
GameLayer

public class LineCountLayer extends Object implements GameLayer
Count the number of lines cleared in the game. End the game if the target number is reached.
  • Constructor Details

    • LineCountLayer

      public LineCountLayer()
  • Method Details

    • setTotal

      public void setTotal(int total)
      Set a target number of lines to be cleared.
      Parameters:
      total -
    • getCnt

      public int getCnt()
      Returns:
      current number of lines cleared
    • onGameStart

      public void onGameStart()
      Description copied from interface: GameLayer
      Define what to initialize before the game starts.
      Specified by:
      onGameStart in interface GameLayer
    • isGameEnd

      public boolean isGameEnd()
      Check if the target number is reached.
      Specified by:
      isGameEnd in interface GameLayer
      Returns:
      ture iff the number of lines cleared is greater than or equal to the target number
    • notifyAllObservers

      public void notifyAllObservers(DataPackage dataPackage)
      Description copied from interface: GameLayer
      Notify all observers that listen to this GameLayer.
      Specified by:
      notifyAllObservers in interface GameLayer
      Parameters:
      dataPackage - - relavent data received from game