mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 18:23:44 +01:00
added documentation for GameBoardSynchronizer
This commit is contained in:
parent
c83f7de30c
commit
1f07affbef
@ -26,9 +26,9 @@ import static pp.util.FloatMath.PI;
|
||||
|
||||
/**
|
||||
* The {@code GameBoardSynchronizer} class is responsible for synchronizing the graphical
|
||||
* representation of the ships and shots on the sea map with the underlying data model.
|
||||
* representation of the Game board and figures with the underlying data model.
|
||||
* It extends the {@link BoardSynchronizer} to provide specific synchronization
|
||||
* logic for the sea map.
|
||||
* logic for the Game board.
|
||||
*/
|
||||
class GameBoardSynchronizer extends BoardSynchronizer {
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
@ -42,9 +42,9 @@ class GameBoardSynchronizer extends BoardSynchronizer {
|
||||
/**
|
||||
* Constructs a {@code GameBoardSynchronizer} object with the specified application, root node, and ship map.
|
||||
*
|
||||
* @param app the Battleship application
|
||||
* @param app the Monopoly application
|
||||
* @param root the root node to which graphical elements will be attached
|
||||
* @param map the ship map containing the ships and shots
|
||||
* @param map the Game Board containing fields and figures
|
||||
*/
|
||||
public GameBoardSynchronizer(MonopolyApp app, Node root, Board board) {
|
||||
super(board, root);
|
||||
@ -54,17 +54,15 @@ class GameBoardSynchronizer extends BoardSynchronizer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits a {@link Battleship} and creates a graphical representation of it.
|
||||
* The representation is either a 3D model or a simple box depending on the
|
||||
* type of battleship.
|
||||
* Visits a {@link Figure} and creates a graphical representation of it.
|
||||
* The representation is a 3D model.
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the node containing the graphical representation of the battleship
|
||||
* @param figure the figure to be represented
|
||||
* @return the node containing the graphical representation of the figure
|
||||
*/
|
||||
public Spatial visit(Figure figure) {
|
||||
final Node node = new Node(FIGURE);
|
||||
node.attachChild(createBox(figure));
|
||||
// compute the center of the ship in world coordinates
|
||||
final float x = 1;
|
||||
final float z = 1;
|
||||
node.setLocalTranslation(x, 0f, z);
|
||||
@ -72,10 +70,10 @@ class GameBoardSynchronizer extends BoardSynchronizer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a simple box to represent a battleship that is not of the "King George V" type.
|
||||
* Creates a representation of a figure
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the geometry representing the battleship as a box
|
||||
* @param figure the figure to be represented
|
||||
* @return the geometry representing the figure
|
||||
*/
|
||||
private Spatial createBox(Figure figure) {
|
||||
final Box box = new Box(0.5f * (figure.getMaxY() - figure.getMinY()) + 0.3f,
|
||||
|
Loading…
Reference in New Issue
Block a user