public class MapTiles
extends java.lang.Object
MapManager
.Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
PIXEL_ON_METER
Represents the proportion between pixels and meters.
|
Modifier and Type | Method and Description |
---|---|
void |
addSemaphore(Semaphore s)
Add a new semaphore which will be managed by ThreadTL.
|
void |
addSpawnCoordinates(Coordinates spawnCoords)
Add a spawn point with coordinates to the map.
|
void |
addTile(ITile tile)
Adds the tile passed as parameter at the position specified in the
ITile object. |
static void |
createInstance(java.lang.Integer mapHeight,
java.lang.Integer mapWidth)
Creates the instance of the class, calls the constructor of the class in
order to allocate the singleton.
|
static MapTiles |
getInstance()
Returns the singleton of the class.
|
ITile[][] |
getMap()
Return loaded map.
|
java.util.List<Semaphore> |
getSemaphoreList()
Returns the iterator of the associated traffic lights' crosses.
|
java.util.List<Coordinates> |
getSpawnCoordinates()
Return all spawn points of the map.
|
ITile |
getTileAt(Coordinates pos)
Returns the tile at the specified position.
|
static boolean |
isInstantiated()
Checks if the singleton of the class has been allocated.
|
static java.lang.Integer |
metersToPixel(float meters)
Converts meters to pixels.
|
static double |
pixelToMeters(java.lang.Integer pixel)
Converts pixels to meters.
|
public static final java.lang.Integer PIXEL_ON_METER
public static void createInstance(java.lang.Integer mapHeight, java.lang.Integer mapWidth) throws java.lang.IllegalStateException
mapHeight
- the height of the mapmapWidth
- the width of the mapjava.lang.IllegalStateException
- if the singleton has been already allocatedpublic static MapTiles getInstance() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the singleton hasn't been allocated yetpublic static boolean isInstantiated()
public static double pixelToMeters(java.lang.Integer pixel)
pixel
- the pixel to be transformedpublic static java.lang.Integer metersToPixel(float meters)
meters
- the meters to be transformedpublic java.util.List<Semaphore> getSemaphoreList()
public ITile getTileAt(Coordinates pos)
pos
- the position of the tile to obtainITile
public void addTile(ITile tile)
ITile
object.tile
- the tile to be insertedpublic void addSpawnCoordinates(Coordinates spawnCoords)
spawnPoint
- coordinates of spawn pointpublic java.util.List<Coordinates> getSpawnCoordinates()
public ITile[][] getMap()
public void addSemaphore(Semaphore s)
s
- the new semaphore to be added