added missing documentation

This commit is contained in:
Yvonne Schmidt 2024-10-13 12:53:02 +02:00
parent 520b98f693
commit 1288d6d1ca

View File

@ -38,7 +38,7 @@ import static pp.util.FloatMath.QUARTER_PI;
/** /**
* The {@code SeaSynchronizer} class is responsible for synchronizing the graphical * 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 * It extends the {@link ShipMapSynchronizer} to provide specific synchronization
* logic for the sea map. * logic for the sea map.
*/ */
@ -67,11 +67,11 @@ class SeaSynchronizer extends ShipMapSynchronizer {
private static final boolean POINT_SPRITE = true; private static final boolean POINT_SPRITE = true;
private static final Type EMITTER_TYPE = POINT_SPRITE ? Type.Point : Type.Triangle; 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 * @return flame texture
*/ */
private ParticleEmitter createFlame(){ private ParticleEmitter createFlame(){
flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR);
flame.setSelectRandomImage(true); flame.setSelectRandomImage(true);
@ -96,6 +96,10 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return flame; return flame;
} }
/**
* Creates a Flash texture
* @return flash texture
*/
private ParticleEmitter createFlash(){ private ParticleEmitter createFlash(){
flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR); flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR);
flash.setSelectRandomImage(true); flash.setSelectRandomImage(true);
@ -121,6 +125,10 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return flash; return flash;
} }
/**
* Creates small spark particles, that dissipate into the air
* @return spark texture
*/
private ParticleEmitter createRoundSpark(){ private ParticleEmitter createRoundSpark(){
roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR); roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR);
roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F))); 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; return spark;
} }
/**
* creates a dynamic smoke trail
* @return smoke texture
*/
private ParticleEmitter createSmokeTrail(){ private ParticleEmitter createSmokeTrail(){
smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR); smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR);
smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F)); smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F));
@ -192,6 +204,10 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return smoketrail; return smoketrail;
} }
/**
* creates flying debris particles
* @return debris texture
*/
private ParticleEmitter createDebris(){ private ParticleEmitter createDebris(){
debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR); debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
debris.setSelectRandomImage(true); debris.setSelectRandomImage(true);
@ -219,6 +235,10 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return debris; return debris;
} }
/**
* creates an expanding circular shockwave
* @return shockwave texture
*/
private ParticleEmitter createShockwave(){ private ParticleEmitter createShockwave(){
shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR); shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR);
// shockwave.setRandomAngle(true); // shockwave.setRandomAngle(true);
@ -245,6 +265,11 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return shockwave; return shockwave;
} }
/**
* creates an animated smoke column
* @return moving smoke texture
*/
private ParticleEmitter createMovingSmokeEmitter() { private ParticleEmitter createMovingSmokeEmitter() {
ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300); ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300);
smokeEmitter.setGravity(0, 0, 0); smokeEmitter.setGravity(0, 0, 0);
@ -346,12 +371,17 @@ class SeaSynchronizer extends ShipMapSynchronizer {
flame.emitAllParticles(); flame.emitAllParticles();
roundSpark.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; return null;
} }
/** /**
* Creates a cylinder geometry representing the specified shot. * Creates a cylinder geometry representing the specified shot.
* The appearance of the cylinder depends on whether the shot is a hit or a miss. * The appearance of the cylinder depends on whether the shot is a hit or a miss.