vutbr.checkers.game
Class GamePiece

java.lang.Object
  extended by vutbr.checkers.game.GamePiece
Direct Known Subclasses:
GamePieceKing, GamePieceMan

public abstract class GamePiece
extends java.lang.Object

Trida GamePiece - figurka

Author:
Ondrej Novy

Constructor Summary
GamePiece(GameBoard board, int x, int y, Game.GameColor color)
          Konstruktor
 
Method Summary
protected  GameBoard getBoard()
          Vrati hraci plochu
 Game.GameColor getColor()
          Vrati barvu figurky
protected  int getX()
          Vrati souradnici X
protected  int getY()
          Vrati souradnici Y
protected  boolean possibleTurn(int toX, int toY)
          Overi, zda je tento tah mozny
protected  void setColor(Game.GameColor color)
          Nastavi barvu figurky
protected  void setX(int x)
          Nastavi souradnici X
protected  void setY(int y)
          Nastavi souradnici Y
protected abstract  boolean turn(int toX, int toY, GameTurnState gameTurnState)
          Provede tah figurkou
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GamePiece

public GamePiece(GameBoard board,
                 int x,
                 int y,
                 Game.GameColor color)
Konstruktor

Parameters:
board - Hraci plocha
x - Souradnice X
y - Souradnice Y
color - Barva figurky
Method Detail

getBoard

protected GameBoard getBoard()
Vrati hraci plochu

Returns:
Hraci plocha

setX

protected void setX(int x)
Nastavi souradnici X

Parameters:
x - Souradnice X

getX

protected int getX()
Vrati souradnici X

Returns:
Souradnice X

setY

protected void setY(int y)
Nastavi souradnici Y

Parameters:
y - Souradnice Y

getY

protected int getY()
Vrati souradnici Y

Returns:
Souradnice Y

setColor

protected void setColor(Game.GameColor color)
Nastavi barvu figurky

Parameters:
color - Barva figurky

getColor

public Game.GameColor getColor()
Vrati barvu figurky

Returns:
Barva figurky

turn

protected abstract boolean turn(int toX,
                                int toY,
                                GameTurnState gameTurnState)
Provede tah figurkou

Parameters:
toX - Cilova souradnice X
toY - Cilova souradnice Y
gameTurnState - Stav tahu hry
Returns:
True pokud se tah povedl

possibleTurn

protected boolean possibleTurn(int toX,
                               int toY)
Overi, zda je tento tah mozny

Parameters:
toX - Cilova souradnice X
toY - Cilova souradnice Y
Returns:
True pokud je tah mozny