removed print statements and added documentation.

tags : #story[1273]
This commit is contained in:
Alistair McIntyre
2017-09-26 18:36:13 +13:00
parent f11c457d28
commit 9b00f76907
3 changed files with 56 additions and 0 deletions
@@ -37,6 +37,11 @@ public class ChaseCamera extends PerspectiveCamera implements RaceCamera {
this.verticalPan = 0.0; this.verticalPan = 0.0;
} }
/**
* Sets a player boat object to observe and update the camera with.
*
* @param playerBoat The player boat to be observed.
*/
public void setPlayerBoat(BoatObject playerBoat) { public void setPlayerBoat(BoatObject playerBoat) {
this.playerBoat = playerBoat; this.playerBoat = playerBoat;
@@ -47,6 +52,9 @@ public class ChaseCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Moves the camera to a new position after some change (Zooming or Panning)
*/
private void repositionCamera() { private void repositionCamera() {
transforms.clear(); transforms.clear();
transforms.addAll( transforms.addAll(
@@ -58,6 +66,10 @@ public class ChaseCamera extends PerspectiveCamera implements RaceCamera {
); );
} }
/**
* Adjusts the zoom amount (camera depth) by some adjustment value
* @param adjustment the adjustment to be made to the camera
*/
private void adjustZoomFactor(Double adjustment) { private void adjustZoomFactor(Double adjustment) {
if (zoomFactor + adjustment < NEAR_ZOOM_LIMIT && zoomFactor + adjustment > FAR_ZOOM_LIMIT) { if (zoomFactor + adjustment < NEAR_ZOOM_LIMIT && zoomFactor + adjustment > FAR_ZOOM_LIMIT) {
zoomFactor = zoomFactor + adjustment; zoomFactor = zoomFactor + adjustment;
@@ -65,6 +77,10 @@ public class ChaseCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Adjusts the Vertical Panning of the Camera
* @param adjustment the adjustment to be made to the camera
*/
private void adjustVerticalPan(Double adjustment) { private void adjustVerticalPan(Double adjustment) {
if (verticalPan + adjustment >= -VERTICAL_PAN_LIMIT if (verticalPan + adjustment >= -VERTICAL_PAN_LIMIT
&& verticalPan + adjustment <= VERTICAL_PAN_LIMIT) { && verticalPan + adjustment <= VERTICAL_PAN_LIMIT) {
@@ -73,6 +89,10 @@ public class ChaseCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Adjusts the Horizontal Panning of the Camera.
* @param adjustment the adjustment to be made to the camera
*/
private void adjustHorizontalPan(Double adjustment) { private void adjustHorizontalPan(Double adjustment) {
this.horizontalPan += adjustment; this.horizontalPan += adjustment;
repositionCamera(); repositionCamera();
@@ -36,6 +36,9 @@ public class IsometricCamera extends PerspectiveCamera implements RaceCamera {
updateCamera(); updateCamera();
} }
/**
* Moves the camera to a new position after some change (Zooming or Panning)
*/
private void updateCamera() { private void updateCamera() {
transforms.clear(); transforms.clear();
transforms.addAll( transforms.addAll(
@@ -44,6 +47,11 @@ public class IsometricCamera extends PerspectiveCamera implements RaceCamera {
); );
} }
/**
* Adjusts the zoom amount (camera depth) by some adjustment value
*
* @param adjustment the adjustment to be made to the camera
*/
private void adjustZoomFactor(Double adjustment) { private void adjustZoomFactor(Double adjustment) {
if (zoomFactor + adjustment < NEAR_ZOOM_LIMIT && zoomFactor + adjustment > FAR_ZOOM_LIMIT) { if (zoomFactor + adjustment < NEAR_ZOOM_LIMIT && zoomFactor + adjustment > FAR_ZOOM_LIMIT) {
zoomFactor = zoomFactor + adjustment; zoomFactor = zoomFactor + adjustment;
@@ -51,6 +59,10 @@ public class IsometricCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Adjusts the Vertical Panning of the Camera
* @param adjustment the adjustment to be made to the camera
*/
private void adjustVerticalPan(Double adjustment) { private void adjustVerticalPan(Double adjustment) {
if (verticalPan + adjustment >= MIN_Y && verticalPan + adjustment <= MAX_Y) { if (verticalPan + adjustment >= MIN_Y && verticalPan + adjustment <= MAX_Y) {
verticalPan += adjustment; verticalPan += adjustment;
@@ -58,6 +70,10 @@ public class IsometricCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Adjusts the Horizontal Panning of the Camera.
* @param adjustment the adjustment to be made to the camera
*/
private void adjustHorizontalPan(Double adjustment) { private void adjustHorizontalPan(Double adjustment) {
if (horizontalPan + adjustment >= MIN_X && horizontalPan + adjustment <= MIN_Y) { if (horizontalPan + adjustment >= MIN_X && horizontalPan + adjustment <= MIN_Y) {
this.horizontalPan += adjustment; this.horizontalPan += adjustment;
@@ -32,6 +32,11 @@ public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
verticalPan = 0.0; verticalPan = 0.0;
} }
/**
* Sets a player boat object to observe and update the camera with.
*
* @param playerBoat The player boat to be observed.
*/
public void setPlayerBoat(BoatObject playerBoat) { public void setPlayerBoat(BoatObject playerBoat) {
this.playerBoat = playerBoat; this.playerBoat = playerBoat;
@@ -41,6 +46,9 @@ public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Moves the camera to a new position after some change (Zooming or Panning)
*/
private void updateCamera() { private void updateCamera() {
transforms.clear(); transforms.clear();
transforms.addAll( transforms.addAll(
@@ -49,6 +57,10 @@ public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
); );
} }
/**
* Adjusts the zoom amount (camera depth) by some adjustment value
* @param adjustment the adjustment to be made to the camera
*/
private void adjustZoomFactor(Double adjustment) { private void adjustZoomFactor(Double adjustment) {
if (zoomFactor + adjustment < NEAR_ZOOM_LIMIT && zoomFactor + adjustment > FAR_ZOOM_LIMIT) { if (zoomFactor + adjustment < NEAR_ZOOM_LIMIT && zoomFactor + adjustment > FAR_ZOOM_LIMIT) {
zoomFactor = zoomFactor + adjustment; zoomFactor = zoomFactor + adjustment;
@@ -56,6 +68,10 @@ public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Adjusts the Vertical Panning of the Camera
* @param adjustment the adjustment to be made to the camera
*/
private void adjustVerticalPan(Double adjustment) { private void adjustVerticalPan(Double adjustment) {
if (verticalPan + adjustment >= -PAN_LIMIT && verticalPan + adjustment <= PAN_LIMIT) { if (verticalPan + adjustment >= -PAN_LIMIT && verticalPan + adjustment <= PAN_LIMIT) {
verticalPan += adjustment; verticalPan += adjustment;
@@ -63,6 +79,10 @@ public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
} }
} }
/**
* Adjusts the Horizontal Panning of the Camera.
* @param adjustment the adjustment to be made to the camera
*/
private void adjustHorizontalPan(Double adjustment) { private void adjustHorizontalPan(Double adjustment) {
if (horizontalPan + adjustment >= -PAN_LIMIT && horizontalPan + adjustment <= PAN_LIMIT) { if (horizontalPan + adjustment >= -PAN_LIMIT && horizontalPan + adjustment <= PAN_LIMIT) {
horizontalPan += adjustment; horizontalPan += adjustment;