public class MapTilePathModel extends FeatureModel implements MapTilePath
Constructor and Description |
---|
MapTilePathModel(Services services)
Create a map tile path.
|
Modifier and Type | Method and Description |
---|---|
void |
addObjectId(int tx,
int ty,
Integer id)
Add object ID at this location.
|
Collection<String> |
getCategories()
Return the categories.
|
CoordTile |
getClosestAvailableTile(Pathfindable mover,
int stx,
int sty,
int dtx,
int dty,
int radius)
Get the closest unused location around the area.
|
CoordTile |
getClosestAvailableTile(Pathfindable mover,
Tiled to,
int radius)
Get the closest unused location around the area.
|
double |
getCost(Pathfindable mover,
int tx,
int ty)
Get the cost of the complete path, from start to end.
|
CoordTile |
getFreeTileAround(Pathfindable mover,
int tx,
int ty,
int tw,
int th,
int radius)
Search a free area from this location.
|
CoordTile |
getFreeTileAround(Pathfindable mover,
Tiled tiled)
Search a free area from this location.
|
CoordTile |
getFreeTileAround(Pathfindable mover,
Tiled tiled,
int radius)
Search a free area from this location.
|
Collection<Integer> |
getObjectsId(int tx,
int ty)
Get objects ID at this location.
|
Tile |
getTile(Tiled tiled)
Get tile from specified map location (in tile index).
|
boolean |
isAreaAvailable(Pathfindable mover,
int tx,
int ty,
int tw,
int th,
Integer ignoreObjectId)
Check if area if unused.
|
boolean |
isBlocked(Pathfindable mover,
int tx,
int ty,
boolean ignoreObjectsId)
Check if current location is blocking or not.
|
void |
loadPathfinding(Media pathfindingConfig)
Load map pathfinding from an external file.
|
void |
removeObjectId(int tx,
int ty,
Integer id)
Remove object ID from this location.
|
checkListener, getFeature, getFeatures, getFeaturesType, hasFeature, prepare
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkListener, prepare
getFeature, getFeatures, getFeaturesType, hasFeature
public MapTilePathModel(Services services)
The Services
must provide the following services:
The MapTile
must provide the following features:
services
- The services reference.LionEngineException
- If services not found.public void loadPathfinding(Media pathfindingConfig)
MapTilePath
loadPathfinding
in interface MapTilePath
pathfindingConfig
- The pathfinding descriptor.public void addObjectId(int tx, int ty, Integer id)
MapTilePath
addObjectId
in interface MapTilePath
tx
- The horizontal tile index.ty
- The vertical tile index.id
- The ID to store.public void removeObjectId(int tx, int ty, Integer id)
MapTilePath
removeObjectId
in interface MapTilePath
tx
- The horizontal tile index.ty
- The vertical tile index.id
- The ID to remove.public Collection<Integer> getObjectsId(int tx, int ty)
MapTilePath
getObjectsId
in interface MapTilePath
tx
- The horizontal tile index.ty
- The vertical tile index.public Tile getTile(Tiled tiled)
MapTilePath
null
, this
means that there is not tile at this location. It is not an error, just a way to avoid useless tile storage.getTile
in interface MapTilePath
tiled
- The location.public boolean isBlocked(Pathfindable mover, int tx, int ty, boolean ignoreObjectsId)
MapTilePath
isBlocked
in interface MapTilePath
mover
- The object moving on map.tx
- The horizontal tile index.ty
- The vertical tile index.ignoreObjectsId
- The ignore map objects ID checking (objects ID on tile).true
if blocking, false
else.public double getCost(Pathfindable mover, int tx, int ty)
MapTilePath
getCost
in interface MapTilePath
mover
- The object moving on map.tx
- The horizontal tile index.ty
- The vertical tile index.public Collection<String> getCategories()
MapTilePath
getCategories
in interface MapTilePath
public CoordTile getFreeTileAround(Pathfindable mover, Tiled tiled)
MapTilePath
getFreeTileAround
in interface MapTilePath
mover
- The object moving on map.tiled
- The object to search around.null
if none).public CoordTile getFreeTileAround(Pathfindable mover, Tiled tiled, int radius)
MapTilePath
getFreeTileAround
in interface MapTilePath
mover
- The object moving on map.tiled
- The object to search around.radius
- The search radius.null
if none).public CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius)
MapTilePath
getFreeTileAround
in interface MapTilePath
mover
- The object moving on map.tx
- The horizontal tile index.ty
- The vertical tile index.tw
- The width in tile.th
- The height in tile.radius
- The search radius.null
if none).public CoordTile getClosestAvailableTile(Pathfindable mover, Tiled to, int radius)
MapTilePath
getClosestAvailableTile
in interface MapTilePath
mover
- The object moving on map.to
- The tiled destination.radius
- The search radius.public CoordTile getClosestAvailableTile(Pathfindable mover, int stx, int sty, int dtx, int dty, int radius)
MapTilePath
getClosestAvailableTile
in interface MapTilePath
mover
- The object moving on map.stx
- The horizontal starting tile index.sty
- The vertical starting tile index.dtx
- The horizontal destination tile index.dty
- The vertical destination tile index.radius
- The search radius.public boolean isAreaAvailable(Pathfindable mover, int tx, int ty, int tw, int th, Integer ignoreObjectId)
MapTilePath
isAreaAvailable
in interface MapTilePath
mover
- The object moving on map.tx
- The horizontal tile index.ty
- The vertical tile index.tw
- The width in tile.th
- The height in tile.ignoreObjectId
- The object ID to ignore.true
if area is free, false
else.Copyright © 2017 Byron 3D Games Studio. All rights reserved.