-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransporterRoom.java
More file actions
61 lines (49 loc) · 1.46 KB
/
TransporterRoom.java
File metadata and controls
61 lines (49 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import java.util.HashMap;
/**
* Piece dont les sorties sont aleatoires
* @author Clément Chomicki
*/
public class TransporterRoom extends Room
{
private RoomRandomizer aNeighborhood;
/**
* Constructeur
* @param pDescription La chaine de caractere decrivant la piece.
* @param pImgName le nom de l'image.
* @param pMap le HashMap des Rooms dont disposera le RoomRandomizer
*/
public TransporterRoom(final String pDescription,
final String pImgName,
final HashMap<String, Room> pMap)
{
super(pDescription, pImgName);
this.aNeighborhood = new RoomRandomizer(pMap);
} //TransporterRoom()
/**
* teste si le mot designe une Room de l'objet
* @param pWord le mot a teste
* @return un boolean
*/
public boolean doesExist(final String pWord)
{
return this.aNeighborhood.doesExist(pWord);
} //doesExist()
/**
* utile pour la commande alea
* @param pString la String designant la prochaine Room tiree
*/
public void setNext(final String pString)
{
this.aNeighborhood.setNext(pString);
} //setNext()
/**
* Retourne la piece direction demandee (ici totalement aléatoire)
* @param pDirection La chaine de caractere indiquant la direction.
* @return La piece sortie demandee.
*/
@Override
public Room getExit(final String pDirection)
{
return this.aNeighborhood.getRandomRoom();
} // getExit
}