Merge remote-tracking branch 'origin/master'

This commit is contained in:
Seraina 2022-03-21 13:21:23 +01:00
commit 52500dc168
5 changed files with 40 additions and 4 deletions

View File

@ -6,7 +6,7 @@ In this game you find yourself under five others on a night train to Budapest. O
If you are playing as a human your task is it to find the menacing creature that is turning everybody so you can safely reach your destiny in human form.
If you are playing as a ghost u aim to turn all humans into your peers and hide the original ghost's identity.
If you are playing as a ghost you aim to turn all humans into your peers and hide the original ghost's identity.
Votes are held in the night for the ghosts to decide who will be next and during the day for the humans to decide who they think the ghost is.

View File

@ -19,11 +19,12 @@ public class GhostPlayer extends Ghost{
isPlayer = true;
kickedOff = false;
if (name == null) {
this.name = "Human Nr. " + position;
this.name = "Player Nr. " + position;
} else this.name = name;
}
public void send(String msg) {
//todo: pass message along to client.
//todo(Jonas): pass message along to client.
}
}

View File

@ -1,5 +1,20 @@
package ch.unibas.dmi.dbis.cs108.Klassenstruktur;
public class HumanNPC extends Human {
/**
* Creates a new GhostNPC. Should be used at game start or if a HumanNPC is turned into a ghost.
* @param position position on the train
* @param name player name. if null, then a default name is used.
*
*/
public HumanNPC(int position, String name) {
this.position = position;
this.sock = null;
isGhost = false;
isPlayer = false;
kickedOff = false;
if (name == null) {
this.name = "Robot Nr. " + position;
} else this.name = name;
}
}

View File

@ -1,4 +1,24 @@
package ch.unibas.dmi.dbis.cs108.Klassenstruktur;
import java.net.Socket;
public class HumanPlayer extends Human{
/**
* Creates a new GhostPlayer. Should be used at game start or if a HumanPlayer is turned into a ghost.
* @param position position on the train
* @param name name. if null, then a default name is used.
* @param sock the socket for the player.
*/
public HumanPlayer(int position, String name, Socket sock, boolean isOG) {
this.position = position;
this.sock = sock;
isGhost = false;
isPlayer = true;
kickedOff = false;
if (name == null) {
this.name = "Player Nr. " + position;
} else this.name = name;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB