-
Notifications
You must be signed in to change notification settings - Fork 0
/
Room.java
56 lines (49 loc) · 848 Bytes
/
Room.java
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
public class Room implements Comparable<Room>
{
public boolean isInner = false;
public int hallwayIndex = -1;
public boolean isExit = false;
public RoomItem item = RoomItem.None;
public Room(int myIndex, RoomItem roomItem)
{
if(myIndex >= 10)
{
myIndex -= 10;
isInner = true;
}
hallwayIndex = myIndex;
item = roomItem;
}
public int getIndex()
{
return hallwayIndex;
}
public String getHallway()
{
return isInner ? "Inner" : "Outter";
}
public boolean getIsInnerHallway()
{
return isInner;
}
public void setRoomItem(RoomItem newItem)
{
item = newItem;
}
public RoomItem getRoomItem()
{
return item;
}
@Override
public int compareTo(Room otherRoom)
{
if(this.isInner == otherRoom.isInner && this.hallwayIndex == otherRoom.hallwayIndex)
{
return 0;
}
else
{
return -1;
}
}
}