effect when opponent miss the ship

This commit is contained in:
Tamino Mueller 2024-10-14 08:12:37 +02:00
parent 0fd0555dea
commit 7d70e8bd13
2 changed files with 13 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
*/
@Override
public Spatial visit(Shot shot) {
return shot.isHit() ? handleHit(shot) : createCylinder(shot);
return shot.isHit() ? handleHit(shot) : handleMiss(shot);
}
/**
@ -136,6 +136,18 @@ class SeaSynchronizer extends ShipMapSynchronizer {
return null;
}
private Spatial handleMiss(Shot shot) {
Node shotNode = new Node("ShotNode");
Geometry shotCylinder = createCylinder(shot);
shotNode.attachChild(shotCylinder);
ParticleEmitter waterSplash = particleFactory.createWaterSplash();
waterSplash.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f);
shotNode.attachChild(waterSplash);
waterSplash.emitAllParticles();
return shotNode;
}
/**
* Creates a cylinder geometry representing the specified shot.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB