Add missle sound
This commit is contained in:
@@ -34,6 +34,7 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
private AudioNode splashSound;
|
private AudioNode splashSound;
|
||||||
private AudioNode shipDestroyedSound;
|
private AudioNode shipDestroyedSound;
|
||||||
private AudioNode explosionSound;
|
private AudioNode explosionSound;
|
||||||
|
private AudioNode missleSound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if sound is enabled in the preferences.
|
* Checks if sound is enabled in the preferences.
|
||||||
@@ -78,6 +79,7 @@ public void initialize(AppStateManager stateManager, Application app) {
|
|||||||
shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
|
shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
|
||||||
splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS
|
splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS
|
||||||
explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS
|
explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS
|
||||||
|
missleSound = loadSound(app, "Sound/Effects/missle.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,6 +110,14 @@ public void splash() {
|
|||||||
splashSound.playInstance();
|
splashSound.playInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays the missle flyby sound effect.
|
||||||
|
*/
|
||||||
|
public void flyBy() {
|
||||||
|
if (isEnabled() && missleSound != null)
|
||||||
|
missleSound.playInstance();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays the explosion sound effect.
|
* Plays the explosion sound effect.
|
||||||
*/
|
*/
|
||||||
@@ -130,6 +140,7 @@ public void receivedEvent(SoundEvent event) {
|
|||||||
case EXPLOSION -> explosion();
|
case EXPLOSION -> explosion();
|
||||||
case SPLASH -> splash();
|
case SPLASH -> splash();
|
||||||
case DESTROYED_SHIP -> shipDestroyed();
|
case DESTROYED_SHIP -> shipDestroyed();
|
||||||
|
case MISSLE_FLYBY -> flyBy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -33,6 +33,7 @@ public AnimationState(ClientGameLogic logic, boolean myTurn, IntPoint position)
|
|||||||
logic.getOpponentMap().add(shell);
|
logic.getOpponentMap().add(shell);
|
||||||
} else {
|
} else {
|
||||||
logic.getOwnMap().add(shell);
|
logic.getOwnMap().add(shell);
|
||||||
|
logic.playSound(Sound.MISSLE_FLYBY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,5 +22,9 @@ public enum Sound {
|
|||||||
/**
|
/**
|
||||||
* Sound of a ship being destroyed.
|
* Sound of a ship being destroyed.
|
||||||
*/
|
*/
|
||||||
DESTROYED_SHIP
|
DESTROYED_SHIP,
|
||||||
|
/**
|
||||||
|
* Sound of an incomming missle.
|
||||||
|
*/
|
||||||
|
MISSLE_FLYBY,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user