diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/SeaSynchronizer.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/SeaSynchronizer.java index d30be9b..8eb7238 100644 --- a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/SeaSynchronizer.java +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/SeaSynchronizer.java @@ -38,7 +38,7 @@ import static pp.util.FloatMath.QUARTER_PI; /** * The {@code SeaSynchronizer} class is responsible for synchronizing the graphical - * representation of the ships and shots on the sea map with the underlying data model. + * representation of the ships and shots on the sea map with the underlying model. * It extends the {@link ShipMapSynchronizer} to provide specific synchronization * logic for the sea map. */ @@ -67,11 +67,11 @@ class SeaSynchronizer extends ShipMapSynchronizer { private static final boolean POINT_SPRITE = true; private static final Type EMITTER_TYPE = POINT_SPRITE ? Type.Point : Type.Triangle; + /** - * Creates a Flame texture with indefininite Lifetime + * Creates a Flame texture with indefinite Lifetime * @return flame texture */ - private ParticleEmitter createFlame(){ flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); flame.setSelectRandomImage(true); @@ -96,6 +96,10 @@ class SeaSynchronizer extends ShipMapSynchronizer { return flame; } + /** + * Creates a Flash texture + * @return flash texture + */ private ParticleEmitter createFlash(){ flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR); flash.setSelectRandomImage(true); @@ -121,6 +125,10 @@ class SeaSynchronizer extends ShipMapSynchronizer { return flash; } + /** + * Creates small spark particles, that dissipate into the air + * @return spark texture + */ private ParticleEmitter createRoundSpark(){ roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR); roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F))); @@ -167,6 +175,10 @@ class SeaSynchronizer extends ShipMapSynchronizer { return spark; } + /** + * creates a dynamic smoke trail + * @return smoke texture + */ private ParticleEmitter createSmokeTrail(){ smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR); smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F)); @@ -192,6 +204,10 @@ class SeaSynchronizer extends ShipMapSynchronizer { return smoketrail; } + /** + * creates flying debris particles + * @return debris texture + */ private ParticleEmitter createDebris(){ debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR); debris.setSelectRandomImage(true); @@ -219,6 +235,10 @@ class SeaSynchronizer extends ShipMapSynchronizer { return debris; } + /** + * creates an expanding circular shockwave + * @return shockwave texture + */ private ParticleEmitter createShockwave(){ shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR); // shockwave.setRandomAngle(true); @@ -245,6 +265,11 @@ class SeaSynchronizer extends ShipMapSynchronizer { return shockwave; } + /** + * creates an animated smoke column + * @return moving smoke texture + */ + private ParticleEmitter createMovingSmokeEmitter() { ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300); smokeEmitter.setGravity(0, 0, 0); @@ -346,12 +371,17 @@ class SeaSynchronizer extends ShipMapSynchronizer { flame.emitAllParticles(); roundSpark.emitAllParticles(); + if (ship.isDestroyed()) { + // Add ShipSinkingControl to the shipNode + ShipSinkingControl sinkingControl = new ShipSinkingControl(2f, 5f, -5f, 60f); + shipNode.addControl(sinkingControl); + sinkingControl.startSinking(); // Start the sinking process + } return null; } - /** * Creates a cylinder geometry representing the specified shot. * The appearance of the cylinder depends on whether the shot is a hit or a miss.