public interface Pathfindable extends Feature, Tiled, Orientable, Updatable, Renderable
MapTilePath
by using A-Star algorithm.Modifier and Type | Method and Description |
---|---|
void |
addListener(PathfindableListener listener)
Add a pathfindable listener.
|
void |
clearIgnoredId()
Clear all ignored objects ID.
|
void |
clearPath()
Clear current used path ID.
|
void |
clearSharedPathIds()
Clear the list of objects ID that share the same path.
|
double |
getCost(String category)
Get the cost movement depending of the category.
|
double |
getMoveX()
Get horizontal current speed.
|
double |
getMoveY()
Get vertical current speed.
|
double |
getSpeedX()
Get horizontal movement speed.
|
double |
getSpeedY()
Get vertical movement speed.
|
boolean |
isBlocking(String category)
Check if the category is considered as blocking.
|
boolean |
isDestinationReached()
Check if has reached destination.
|
boolean |
isIgnoredId(Integer id)
Check if object ID is ignored.
|
boolean |
isMovementAllowed(String category,
MovementTile movement)
Check if movement is allowed for the specified tile.
|
boolean |
isMoving()
Check if currently moving.
|
boolean |
isPathAvailable(int tx,
int ty)
Check if a path exists between object and destination.
|
void |
moveTo(double extrp,
double x,
double y)
Move to specified destination only when calling this function.
|
boolean |
setDestination(int tx,
int ty)
Assign a specified location.
|
boolean |
setDestination(Localizable localizable)
Assign a specified location.
|
boolean |
setDestination(Tiled tiled)
Assign a specified location.
|
void |
setIgnoreId(Integer id,
boolean state)
Ignore an object ID while searching pathfinding.
|
void |
setLocation(CoordTile coord)
Set specified location in tile.
|
void |
setLocation(int tx,
int ty)
Set specified location in tile.
|
void |
setRenderDebug(boolean debug)
Render additional information on path rendering (movement cost for each tile is displayed).
|
void |
setSharedPathIds(Collection<Integer> ids)
Set the object ID list that shares the same path (this can be used in grouped movement).
|
void |
setSpeed(double speedX,
double speedY)
Set movement speed.
|
void |
stopMoves()
Stop any pathfinding movements.
|
checkListener, prepare
getFeature, getFeatures, getFeaturesType, hasFeature
getInTileHeight, getInTileWidth, getInTileX, getInTileY
getOrientation, pointTo, pointTo, setOrientation
render
void addListener(PathfindableListener listener)
listener
- The pathfindable listener to add.void clearPath()
void clearIgnoredId()
void clearSharedPathIds()
void moveTo(double extrp, double x, double y)
extrp
- The extrapolation value.x
- The destination horizontal location.y
- The destination vertical location.void stopMoves()
void setSpeed(double speedX, double speedY)
speedX
- The horizontal speed.speedY
- The vertical speed.void setIgnoreId(Integer id, boolean state)
id
- The object ID to ignore.state
- true
to ignore, false
else.void setSharedPathIds(Collection<Integer> ids)
ids
- The object ID list to add.boolean setDestination(Localizable localizable)
localizable
- The destination location.true
if destination reachable, false
else.boolean setDestination(Tiled tiled)
tiled
- The destination location in tile.true
if destination reachable, false
else.boolean setDestination(int tx, int ty)
tx
- The horizontal location in tile.ty
- The vertical location in tile.true
if destination reachable, false
else.void setLocation(CoordTile coord)
coord
- The coordinate in tile.void setLocation(int tx, int ty)
tx
- The horizontal location in tile.ty
- The vertical location in tile.void setRenderDebug(boolean debug)
debug
- true
to show debug information relative to path, false
else.double getSpeedX()
double getSpeedY()
double getMoveX()
double getMoveY()
double getCost(String category)
category
- The category the check.LionEngineException
- If category has not been found.boolean isMovementAllowed(String category, MovementTile movement)
category
- The category the check.movement
- The movement to check.true
if movement allowed, false
else.LionEngineException
- If category has not been found.boolean isPathAvailable(int tx, int ty)
tx
- The horizontal location in tile.ty
- The vertical location in tile.true
if path exists, false
else.boolean isBlocking(String category)
category
- The category the check.true
if blocking, false
else or category not found.boolean isDestinationReached()
true
if destination has been reached, false
else.boolean isIgnoredId(Integer id)
id
- The object ID to check.true
if ignored, false
else.boolean isMoving()
true
if moving, false
else.Copyright © 2017 Byron 3D Games Studio. All rights reserved.