Added boat model for 1x1 boats

This commit is contained in:
Simon Wilkening
2024-10-12 20:41:35 +02:00
parent 67e4c1e805
commit de0b2a4054
12 changed files with 475513 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
#
# Specifies the map used by the opponent in single mode.
# Single mode is activated if this property is set.
#map.opponent=maps/map2.json
map.opponent=maps/map2.json
#
# Specifies the map used by the player in single mode.
# The player must define their own map if this property is not set.

View File

@@ -35,6 +35,7 @@ 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 KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS
private static final String SMALL_SHIP_MODEL = "Models/SmallShip/SmallShip.j3o"; //NON-NLS
private static final String COLOR = "Color"; //NON-NLS
private static final String SHIP = "ship"; //NON-NLS
private static final String SHOT = "shot"; //NON-NLS
@@ -141,7 +142,17 @@ 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 1:
return createSmallship(ship);
default:
return createBox(ship);
}
}
/**
@@ -196,6 +207,17 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return model;
}
private Spatial createSmallship(Battleship ship) {
final Spatial model = app.getAssetManager().loadModel(SMALL_SHIP_MODEL);
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
model.scale(0.0005f);
model.setShadowMode(ShadowMode.CastAndReceive);
return model;
}
/**
* Calculates the rotation angle for the specified rotation.
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB