This commit is contained in:
Cedric Beck
2024-12-09 04:21:11 +01:00
9 changed files with 25 additions and 4 deletions

View File

@@ -178,7 +178,12 @@ private void handleGame(Notification notification) {
boardHandler.unshieldPiece(n.getPieceUuid());
} else if (notification instanceof PlayCardNotification n) {
if(n.getCard() == BonusCard.TURBO) {
app.getAcousticHandler().playSound(MdgaSound.TURBO);
guiHandler.turbo();
} else if(n.getCard() == BonusCard.SHIELD) {
app.getAcousticHandler().playSound(MdgaSound.SHIELD);
} else if(n.getCard() == BonusCard.SWAP) {
app.getAcousticHandler().playSound(MdgaSound.SWAP);
}
if(n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
else guiHandler.playCardEnemy(n.getColor(), n.getCard());

View File

@@ -147,6 +147,16 @@ public void playSound(MdgaSound sound) {
case TANK_EXPLOSION:
assets.add(new SoundAssetDelayVolume(SoundAsset.EXPLOSION_1, 1.0f, 0f));
break;
case SHIELD:
assets.add(new SoundAssetDelayVolume(SoundAsset.SHIELD, 1.0f, 0f));
break;
case TURBO:
assets.add(new SoundAssetDelayVolume(SoundAsset.SPEED, 1.0f, 0.1f));
assets.add(new SoundAssetDelayVolume(SoundAsset.SPEED, 1.0f, 1.3f));
break;
case SWAP:
assets.add(new SoundAssetDelayVolume(SoundAsset.SWAP, 1.0f, 0f));
break;
default:
break;
}

View File

@@ -40,5 +40,8 @@ public enum MdgaSound {
MATRIX,
TURRET_ROTATE,
TANK_SHOOT,
TANK_EXPLOSION
TANK_EXPLOSION,
SHIELD,
TURBO,
SWAP,
}

View File

@@ -39,7 +39,10 @@ enum SoundAsset {
MATRIX("matrix.wav"),
CONNECTED("connected.wav"),
TURRET_ROTATE("turret_rotate.ogg"),
TANK_SHOOT("tank_shoot.ogg")
TANK_SHOOT("tank_shoot.ogg"),
SHIELD("shield.ogg"),
SPEED("speed.ogg"),
SWAP("swap.ogg"),
;

View File

@@ -84,7 +84,7 @@ public void received(RequestMoveMessage msg, int from){
if(targetNode.isBonus()) {
for (Player p : logic.getGame().getPlayersAsList()) {
if(p.isActive()) {
if(p.getColor() == logic.getGame().getActiveColor()) {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(logic.getGame().draw()));
} else {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));

View File

@@ -48,7 +48,7 @@ public void received(RequestMoveMessage msg, int from){
if(targetNode.isBonus()) {
for (Player p : logic.getGame().getPlayersAsList()) {
if(p.isActive()) {
if(p.getColor() == logic.getGame().getActiveColor()) {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(logic.getGame().draw()));
} else {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));