added groundwork for shell animation
@@ -24,6 +24,7 @@ import com.jme3.scene.shape.Cylinder;
|
||||
import pp.battleship.client.BattleshipApp;
|
||||
import pp.battleship.model.Battleship;
|
||||
import pp.battleship.model.Rotation;
|
||||
import pp.battleship.model.Shell;
|
||||
import pp.battleship.model.ShipMap;
|
||||
import pp.battleship.model.Shot;
|
||||
|
||||
@@ -43,6 +44,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private static final String SMALL_BOAT_MODEL = "Models/BoatSmall/12219_boat_v2_L2.j3o";
|
||||
private static final String BATTLE_MODEL = "Models/Battle/Battle.j3o"; //NON-NLS
|
||||
private static final String CV_MODEL = "Models/CV/CV.j3o"; //NON-NLS
|
||||
private static final String SHELL_MODEL = "Models/Shell/45.j3o";
|
||||
private static final String COLOR = "Color"; //NON-NLS
|
||||
private static final String SHIP = "ship"; //NON-NLS
|
||||
private static final String SHOT = "shot"; //NON-NLS
|
||||
@@ -52,6 +54,8 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
|
||||
private final ShipMap map;
|
||||
private final BattleshipApp app;
|
||||
private Shell shell;
|
||||
private Spatial shellModel;
|
||||
|
||||
private ParticleEmitter flame, flash, spark, roundspark, smoketrail, debris,
|
||||
shockwave;
|
||||
@@ -318,6 +322,21 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
return waterSplash;
|
||||
}
|
||||
|
||||
private void initiateShellFlight(Shot shot) {
|
||||
Vector3f startPosition = new Vector3f(0, 1, 0); // The position where the shell starts, can be adjusted
|
||||
Vector3f targetPosition = new Vector3f(shot.getX() + 0.5f, 0, shot.getY() + 0.5f);
|
||||
|
||||
shell = new Shell(startPosition, targetPosition, 2f); // 2 seconds flight duration
|
||||
shellModel = app.getAssetManager().loadModel(SHELL_MODEL);
|
||||
Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
material.setColor("Color", ColorRGBA.Yellow);
|
||||
shellModel.setMaterial(material);
|
||||
|
||||
// Set the initial position for the shell model
|
||||
shellModel.setLocalTranslation(startPosition);
|
||||
//.attachChild(shellModel); TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code SeaSynchronizer} object with the specified application, root node, and ship map.
|
||||
*
|
||||
|
387991
Projekte/battleship/client/src/main/resources/Models/Shell/45.obj
Normal file
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 3.0 MiB |
After Width: | Height: | Size: 246 KiB |
After Width: | Height: | Size: 330 KiB |