added java docs to model/game and wrote the remaining getter and setter
This commit is contained in:
@@ -1,36 +1,75 @@
|
||||
package pp.mdga.game;
|
||||
|
||||
/**
|
||||
* This class will be used to hold all Piece relevant data.
|
||||
*/
|
||||
public class Piece {
|
||||
private ShieldState shield;
|
||||
private PieceState state;
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* This constructor is used to create a new Piece
|
||||
*
|
||||
* @param color the color of the piece
|
||||
* @param state the state of the piece
|
||||
*/
|
||||
public Piece(Color color, PieceState state) {
|
||||
this.color = color;
|
||||
this.state = state;
|
||||
shield = ShieldState.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public void setShield(ShieldState shield) {
|
||||
this.shield = shield;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public ShieldState getShield() {
|
||||
return shield;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @param state the state of the piece
|
||||
*/
|
||||
public void setState(PieceState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public PieceState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public boolean isShielded() {
|
||||
return shield == ShieldState.ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public boolean isSuppressed() {
|
||||
return shield == ShieldState.SUPPRESSED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user