added init for mdga with all states and messages
This commit is contained in:
47
Projekte/mdga/model/src/main/java/pp.mdga/game/Node.java
Normal file
47
Projekte/mdga/model/src/main/java/pp.mdga/game/Node.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package pp.mdga.game;
|
||||
|
||||
/**
|
||||
* This class will be used the represent a Node on which the pieces can travel along
|
||||
*/
|
||||
public class Node {
|
||||
protected Piece occupant;
|
||||
|
||||
public Node() {}
|
||||
|
||||
/**
|
||||
* This method is used to get an occupant of the Node.
|
||||
*
|
||||
* @return the current occupant of the node
|
||||
*/
|
||||
public Piece getOccupant() {
|
||||
return occupant;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to set a new Occupant
|
||||
*
|
||||
* @param occupant the new occupant of the node
|
||||
*/
|
||||
public void setOccupant(Piece occupant) {
|
||||
if (occupant.isSuppressed()){
|
||||
occupant.setShield(ShieldState.NONE);
|
||||
}
|
||||
this.occupant = occupant;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to clear the node of its occupant
|
||||
*/
|
||||
public void clearOccupant() {
|
||||
this.occupant = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to return a boolean value based on the occupation status
|
||||
*
|
||||
* @return the boolean value corresponding to the occupation status
|
||||
*/
|
||||
public boolean isOccupied() {
|
||||
return occupant != null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user