train horn at the beginning of the game
This commit is contained in:
parent
0b00e236e7
commit
814e78c1e0
@ -122,6 +122,10 @@ public class Game implements Runnable {
|
|||||||
|
|
||||||
LOGGER.info(gameState.toGhostString());
|
LOGGER.info(gameState.toGhostString());
|
||||||
for (ClientHandler client : lobbyClients) {//begins filling the train with clients
|
for (ClientHandler client : lobbyClients) {//begins filling the train with clients
|
||||||
|
|
||||||
|
//send train horn sound to client:
|
||||||
|
client.sendMsgToClient(Protocol.playSound + "$" + "TH");
|
||||||
|
|
||||||
int index = order[i];
|
int index = order[i];
|
||||||
if (passengerTrain[index].getIsGhost()) { //if there is a ghost
|
if (passengerTrain[index].getIsGhost()) { //if there is a ghost
|
||||||
GhostPlayer ghostPlayer = new GhostPlayer(passengerTrain[index].getPosition(),
|
GhostPlayer ghostPlayer = new GhostPlayer(passengerTrain[index].getPosition(),
|
||||||
|
|||||||
@ -105,9 +105,13 @@ public class JClientProtocolParser {
|
|||||||
case "HV":
|
case "HV":
|
||||||
Sound.voteforhuman();
|
Sound.voteforhuman();
|
||||||
break;
|
break;
|
||||||
|
case "TH":
|
||||||
|
Sound.trainhorn();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOGGER.warn("Invalid sound request");
|
LOGGER.warn("Invalid sound request");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println("Received unknown command: " + msg);
|
System.out.println("Received unknown command: " + msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,9 @@ public class Sound {
|
|||||||
static URL bellURL = Sound.class.getResource("sounds/bell.wav");
|
static URL bellURL = Sound.class.getResource("sounds/bell.wav");
|
||||||
static AudioClip bell = new AudioClip(bellURL.toString());
|
static AudioClip bell = new AudioClip(bellURL.toString());
|
||||||
|
|
||||||
|
static URL trainhornURL = Sound.class.getResource("sounds/trainhorn.wav");
|
||||||
|
static AudioClip trainhorn = new AudioClip(trainhornURL.toString());
|
||||||
|
|
||||||
static URL daynoisesURL = Sound.class.getResource("sounds/daynoises.wav");
|
static URL daynoisesURL = Sound.class.getResource("sounds/daynoises.wav");
|
||||||
static AudioClip daynoises = new AudioClip(daynoisesURL.toString());
|
static AudioClip daynoises = new AudioClip(daynoisesURL.toString());
|
||||||
|
|
||||||
@ -103,6 +106,8 @@ public class Sound {
|
|||||||
bell.play(defaultvolume - 0.5);
|
bell.play(defaultvolume - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void trainhorn() {trainhorn.play(defaultvolume); }
|
||||||
|
|
||||||
public static void startDaynoises() {
|
public static void startDaynoises() {
|
||||||
daynoises.setCycleCount(AudioClip.INDEFINITE);
|
daynoises.setCycleCount(AudioClip.INDEFINITE);
|
||||||
daynoises.play(defaultvolume - 0.5);
|
daynoises.play(defaultvolume - 0.5);
|
||||||
|
|||||||
@ -215,7 +215,7 @@ public class Protocol {
|
|||||||
/**
|
/**
|
||||||
* Used to tell the client to play a sound, namely the sounds for when humans have voted for a human (PLSND$HV),
|
* Used to tell the client to play a sound, namely the sounds for when humans have voted for a human (PLSND$HV),
|
||||||
* when humans have voted for a ghost (PLSND$GV), when humans have won (i.e. have voted for the OG - PLSND$HW)
|
* when humans have voted for a ghost (PLSND$GV), when humans have won (i.e. have voted for the OG - PLSND$HW)
|
||||||
* or when ghosts have won (PLSND$GW)
|
* or when ghosts have won (PLSND$GW), or the train horn at the start of the game (PLSND$TH). Not used for ghost sounds.
|
||||||
*/
|
*/
|
||||||
public static final String playSound = "PLSND";
|
public static final String playSound = "PLSND";
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user