public class PathfindableModel extends java.lang.Object implements Pathfindable
Constructor and Description |
---|
PathfindableModel(MapTilePath<?,? extends TilePath<?>> map,
com.b3dgs.lionengine.game.purview.Localizable user,
java.lang.Integer id)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clearIgnoredId()
Clear all ignored id.
|
void |
clearSharedPathIds()
Clear the list of id that share the same path.
|
int |
getLocationInTileX()
Get horizontal location in tile (location on map).
|
int |
getLocationInTileY()
Get vertical location in tile (location on map).
|
double |
getMoveX()
Get horizontal current speed.
|
double |
getMoveY()
Get vertical current speed.
|
double |
getSpeedX()
Get horizontal speed.
|
double |
getSpeedY()
Get vertical speed.
|
boolean |
isDestinationReached()
Check if has reached destination.
|
boolean |
isIgnoredId(java.lang.Integer id)
Check if id is ignored.
|
boolean |
isMoving()
Check is its moving.
|
boolean |
isPathAvailable(int dtx,
int dty)
Check if a path exists between entity and destination.
|
void |
setDestination(double extrp,
double dx,
double dy)
Move to specified destination only on call.
|
boolean |
setDestination(int dtx,
int dty)
Assign a specified location; will move automatically until reach it.
|
void |
setIgnoreId(java.lang.Integer id,
boolean state)
Ignore an id while searching pathfinding.
|
void |
setLocation(int dtx,
int dty)
Set specified location in tile.
|
void |
setSharedPathIds(java.util.Set<java.lang.Integer> ids)
Set the id list that shares the same path (this is used in grouped movement).
|
void |
setSpeed(double speedX,
double speedY)
Set move speed.
|
void |
stopMoves()
Stop any pathfinding movements.
|
void |
updateMoves(double extrp)
Update automatic moves if has.
|
public PathfindableModel(MapTilePath<?,? extends TilePath<?>> map, com.b3dgs.lionengine.game.purview.Localizable user, java.lang.Integer id)
map
- The map reference.user
- The pathfindable user.id
- The id used.public void setDestination(double extrp, double dx, double dy)
Pathfindable
setDestination
in interface Pathfindable
extrp
- The extrapolation value.dx
- The destination x.dy
- The destination y.public boolean setDestination(int dtx, int dty)
Pathfindable
setDestination
in interface Pathfindable
dtx
- The destination x (in tile map).dty
- The destination y (in tile map).true
if target found and valid, false
else.public boolean isPathAvailable(int dtx, int dty)
Pathfindable
isPathAvailable
in interface Pathfindable
dtx
- The destination x (in tile map).dty
- The destination y (in tile map).true
if path exists, false
else.public void setLocation(int dtx, int dty)
Pathfindable
setLocation
in interface Pathfindable
dtx
- The location x in tile.dty
- The location y in tile.public void setIgnoreId(java.lang.Integer id, boolean state)
Pathfindable
setIgnoreId
in interface Pathfindable
id
- The id to ignore.state
- true
to ignore, false
else.public boolean isIgnoredId(java.lang.Integer id)
Pathfindable
isIgnoredId
in interface Pathfindable
id
- The id to check.true
if ignored, false
else.public void clearIgnoredId()
Pathfindable
clearIgnoredId
in interface Pathfindable
public void setSharedPathIds(java.util.Set<java.lang.Integer> ids)
Pathfindable
setSharedPathIds
in interface Pathfindable
ids
- The id list to add.public void clearSharedPathIds()
Pathfindable
clearSharedPathIds
in interface Pathfindable
public void updateMoves(double extrp)
Pathfindable
updateMoves
in interface Pathfindable
extrp
- The extrapolation value.public void stopMoves()
Pathfindable
stopMoves
in interface Pathfindable
public void setSpeed(double speedX, double speedY)
Pathfindable
setSpeed
in interface Pathfindable
speedX
- The horizontal speed.speedY
- The vertical speed.public boolean isMoving()
Pathfindable
isMoving
in interface Pathfindable
true
if moving, false
else.public boolean isDestinationReached()
Pathfindable
isDestinationReached
in interface Pathfindable
true
if destination has been reached, false
else.public double getSpeedX()
Pathfindable
getSpeedX
in interface Pathfindable
public double getSpeedY()
Pathfindable
getSpeedY
in interface Pathfindable
public double getMoveX()
Pathfindable
getMoveX
in interface Pathfindable
public double getMoveY()
Pathfindable
getMoveY
in interface Pathfindable
public int getLocationInTileX()
Pathfindable
getLocationInTileX
in interface Pathfindable
public int getLocationInTileY()
Pathfindable
getLocationInTileY
in interface Pathfindable