added JavaDocs commects where they where missing and removed outcommented code
This commit is contained in:
@@ -119,6 +119,12 @@ public Spatial visit(Battleship ship) {
|
||||
return shipNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* this method will create a representation of a shell in the map
|
||||
*
|
||||
* @param shell the Shell element to visit
|
||||
* @return the node the representation is attached to
|
||||
*/
|
||||
@Override
|
||||
public Spatial visit(Shell shell) {
|
||||
LOGGER.log(Logger.Level.DEBUG, "Visiting {0}", shell);
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
import java.lang.System.Logger;
|
||||
|
||||
/**
|
||||
* This class controls a 3D representation of a shell
|
||||
*/
|
||||
public class ShellControl extends AbstractControl {
|
||||
private final Shell shell;
|
||||
private final BattleshipApp app;
|
||||
@@ -19,11 +22,23 @@ public class ShellControl extends AbstractControl {
|
||||
|
||||
static final Logger LOGGER = System.getLogger(ShellControl.class.getName());
|
||||
|
||||
/**
|
||||
* Constructor to create a new ShellControl object
|
||||
*
|
||||
* @param shell the shell to be displayed
|
||||
* @param app the main application
|
||||
*/
|
||||
public ShellControl(Shell shell, BattleshipApp app) {
|
||||
this.shell = shell;
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
/**
|
||||
* this method moves the representation towards it destination
|
||||
* and deletes it if it reaches its target
|
||||
*
|
||||
* @param tpf time per frame (in seconds)
|
||||
*/
|
||||
@Override
|
||||
protected void controlUpdate(float tpf) {
|
||||
spatial.move(0, -MOVE_SPEED * tpf, 0);
|
||||
@@ -35,8 +50,14 @@ protected void controlUpdate(float tpf) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This method is called during the rendering phase, but it does not perform any
|
||||
* operations in this implementation as the control only influences the spatial's
|
||||
* transformation, not its rendering process.
|
||||
*
|
||||
* @param rm the RenderManager rendering the controlled Spatial (not null)
|
||||
* @param vp the ViewPort being rendered (not null)
|
||||
*/
|
||||
@Override
|
||||
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||
|
||||
|
||||
@@ -9,12 +9,22 @@
|
||||
import pp.battleship.model.IntPoint;
|
||||
import pp.util.Position;
|
||||
|
||||
/**
|
||||
* This class controls a ShellMap element
|
||||
*/
|
||||
public class ShellMapControl extends AbstractControl {
|
||||
private final Position position;
|
||||
private final IntPoint pos;
|
||||
private static final Vector3f vector = new Vector3f();
|
||||
private final BattleshipApp app;
|
||||
|
||||
/**
|
||||
* constructs a new ShellMapControl object
|
||||
*
|
||||
* @param position the position where the shell should move to on the map
|
||||
* @param app the main application
|
||||
* @param pos the position the then to render shot goes to
|
||||
*/
|
||||
public ShellMapControl(Position position, BattleshipApp app, IntPoint pos) {
|
||||
super();
|
||||
this.position = position;
|
||||
@@ -23,6 +33,12 @@ public ShellMapControl(Position position, BattleshipApp app, IntPoint pos) {
|
||||
vector.set(new Vector3f(position.getX(), position.getY(), 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* this method moves the shell representation to its correct spot and removes it after
|
||||
* it arrived at its destination
|
||||
*
|
||||
* @param tpf time per frame (in seconds)
|
||||
*/
|
||||
@Override
|
||||
protected void controlUpdate(float tpf) {
|
||||
spatial.move(vector.mult(tpf));
|
||||
@@ -32,6 +48,14 @@ protected void controlUpdate(float tpf) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called during the rendering phase, but it does not perform any
|
||||
* operations in this implementation as the control only influences the spatial's
|
||||
* transformation, not its rendering process.
|
||||
*
|
||||
* @param rm the RenderManager rendering the controlled Spatial (not null)
|
||||
* @param vp the ViewPort being rendered (not null)
|
||||
*/
|
||||
@Override
|
||||
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user