added alienboat

This commit is contained in:
Tamino Mueller
2024-10-11 01:39:25 +02:00
parent 1f75f7bf30
commit d5450df77c
8 changed files with 18211 additions and 16 deletions

View File

@@ -34,6 +34,8 @@ import static pp.util.FloatMath.PI;
*/
class SeaSynchronizer extends ShipMapSynchronizer {
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
private static final String ALIENSHIP = "Models/Alienship/Alienship.j3o";
private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS
private static final String COLOR = "Color"; //NON-NLS
private static final String SHIP = "ship"; //NON-NLS
@@ -141,15 +143,32 @@ class SeaSynchronizer extends ShipMapSynchronizer {
* @return the spatial representing the battleship
*/
private Spatial createShip(Battleship ship) {
return ship.getLength() == 4 ? createBattleship(ship) : createBox(ship);
}
switch (ship.getLength()) {
case 4:
return createBattleship(ship);
case 5:
return createAllienship(ship);
/**
* Creates a simple box to represent a battleship that is not of the "King George V" type.
*
* @param ship the battleship to be represented
* @return the geometry representing the battleship as a box
*/
default:
return createBox(ship);
}
}
private Spatial createAllienship(Battleship ship) {
final Spatial model = app.getAssetManager().loadModel(ALIENSHIP);
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
model.scale(0.0005f);
model.setShadowMode(ShadowMode.CastAndReceive);
return model;}
/**
* Creates a simple box to represent a battleship that is not of the "King George V" type.
*
* @param ship the battleship to be represented
* @return the geometry representing the battleship as a box
*/
private Spatial createBox(Battleship ship) {
final Box box = new Box(0.5f * (ship.getMaxY() - ship.getMinY()) + 0.3f,
0.3f,

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB