public class Room
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Room.Transition
This object stores data the links the rooms together
|
Modifier and Type | Field and Description |
---|---|
private float |
animationStateTime |
private java.util.List<Clue> |
cluesInRoom
This is a list of the clues in the room.
|
java.util.List<Vector2Int> |
hidingSpots
This list stores the coordinates of all hideable slots in this room
|
private int |
ID
The integer ID of the room
|
private boolean[][] |
lockedTiles
This stores the coordinates of the map in a 2x2 array.
|
private com.badlogic.gdx.maps.tiled.TiledMap |
map
This stores the TMX map loaded from the String mapFile
mapFile |
private java.lang.String |
mapFile
The string that points to the tmx map file for this room.
|
private boolean |
murderRoom
This stores whether or not the room is the room where the murder happened
|
private java.lang.String |
name
This stores the name of the room.
|
private java.util.List<Room.Transition> |
roomTransitions
Room transitions stored as custom Transition object.
|
Constructor and Description |
---|
Room(int id,
java.lang.String mapFile,
java.lang.String name)
Constructor that builds a Room object from the given parameters
|
Modifier and Type | Method and Description |
---|---|
void |
addClue(Clue newClue)
Adds a clue to the room.
|
Room |
addTransition(Room.Transition t)
This adds a transition to the map.
|
void |
drawClues(float delta,
com.badlogic.gdx.graphics.g2d.Batch batch)
This method draws the clues that are in the clue with the asset CLUE_GLINT
|
boolean |
equals(java.lang.Object obj)
This method checks equality between the Room and another object
|
Clue |
getClue(int x,
int y)
This method takes a location parameter and checks it for a clue, if a clue is found it is removed from the map and return
|
java.util.List<Vector2Int> |
getHidingSpots()
This will check the map for any potential hiding locations, and returns them as a list of
coordinates.
|
int |
getID()
Returns the integer ID of the room
|
java.lang.String |
getMatRotation(int x,
int y)
This method gets the rotation that the map is that they are standing on.
|
java.lang.String |
getName()
This returns the String name of the room
|
Vector2Int |
getRandHidingSpot()
This gets a random possible location to hide a clue in
|
Vector2Int |
getRandomLocation()
This method returns a random location in the room that is walkable
|
com.badlogic.gdx.maps.tiled.TiledMap |
getTiledMap()
This returns the tiledMap for this room
|
Room.Transition |
getTransitionData(int x,
int y)
This method will get the transition data (if available)
for the associated door mat in this room at the location x y.
|
private Room.Transition |
hasTransition(Vector2Int v)
This method checks through all the transitions of this room and if one exists where the FROM property is equal to the parameter 'v' then
it returns that Transition, else, it returns null
|
boolean |
isHidingPlace(int x,
int y)
This method checks whether the tile at x, y is a tile you can hide a clue
in
|
boolean |
isMurderRoom()
Returns True if it's the room the murder took place in
|
boolean |
isTriggerTile(int x,
int y)
This method checks ALL layers for the tile at x, y to see if it is a trigger tile.
|
boolean |
isWalkableTile(int x,
int y)
This method takes a current X and Y coordinate and checks through all the layers on the map to see if any tile IS NOT
movable.
|
void |
lockCoordinate(int x,
int y)
This method locks the specified coordinates so no other people object can move to it
|
void |
setMurderRoom()
Sets the room to be the murder room
|
void |
unlockCoordinate(int x,
int y)
This method unlocks the specified coordinates so other people object can move to it
|
public java.util.List<Vector2Int> hidingSpots
Hideable slots are tiles that the clues can be hidden in
private java.lang.String name
private int ID
private java.lang.String mapFile
private java.util.List<Clue> cluesInRoom
private boolean murderRoom
private com.badlogic.gdx.maps.tiled.TiledMap map
mapFile
private boolean[][] lockedTiles
private java.util.List<Room.Transition> roomTransitions
private float animationStateTime
public Room(int id, java.lang.String mapFile, java.lang.String name)
id
- - The integer ID of the roommapFile
- - The String that points to the tmx map file.name
- - The name of the roompublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- - The object to be checked againstID
public boolean isMurderRoom()
murderRoom
public void setMurderRoom()
public int getID()
ID
public java.lang.String getName()
name
public void addClue(Clue newClue)
newClue
- - The clue to add to the roompublic Clue getClue(int x, int y)
x
- - The x coordinate the player is aty
- - The y coordinate the player is atpublic void drawClues(float delta, com.badlogic.gdx.graphics.g2d.Batch batch)
delta
- - The time passed since the last draw. Used for the animationbatch
- - The batch to draw the sprites topublic boolean isHidingPlace(int x, int y)
x
- - The x coordinate to checky
- - The y coordinate to checkpublic void lockCoordinate(int x, int y)
x
- - The x coordinate to locky
- - The y coordinate to lockpublic void unlockCoordinate(int x, int y)
x
- - The x coordinate to unlocky
- - The y coordinate to unlockpublic boolean isWalkableTile(int x, int y)
x
- - The x coordinate to checky
- - The y coordinate to checkpublic boolean isTriggerTile(int x, int y)
x
- - The x coordinate to checky
- - The y coordinate to checkpublic java.lang.String getMatRotation(int x, int y)
x
- - The x coordinate to checky
- = The y coordinate to checkpublic com.badlogic.gdx.maps.tiled.TiledMap getTiledMap()
public Room addTransition(Room.Transition t)
t
- - The transition to be addedpublic java.util.List<Vector2Int> getHidingSpots()
public Vector2Int getRandHidingSpot()
public Room.Transition getTransitionData(int x, int y)
x
- - The current x coordinate in the room (in terms of tiles not pixels)y
- - The current y coordinate in the room (in terms of tiles not pixels)private Room.Transition hasTransition(Vector2Int v)
v
- - The vector containing the FROM coordinatespublic Vector2Int getRandomLocation()