public class EntityNavigator extends java.lang.Object implements IUpdateable, IRenderable
Constructor and Description |
---|
EntityNavigator(IMobileEntity entity,
PathFinder pathFinder)
Instantiates a new entity navigator.
|
Modifier and Type | Method and Description |
---|---|
void |
addNavigationListener(NavigationListener listener) |
void |
cancelNavigation(java.util.function.Predicate<IMobileEntity> predicate) |
float |
getAcceptableError() |
IMobileEntity |
getEntity() |
Path |
getPath() |
PathFinder |
getPathFinder() |
boolean |
isNavigating() |
boolean |
navigate(java.awt.geom.Path2D path) |
boolean |
navigate(java.awt.geom.Point2D target) |
void |
removeNavigationListener(NavigationListener listener) |
void |
render(java.awt.Graphics2D g) |
void |
rotateTowards(java.awt.geom.Point2D target) |
void |
setAcceptableError(float acceptableError) |
void |
stop() |
void |
update()
This method is called by the game loop on all objects that need to update
their attributes.
|
public EntityNavigator(IMobileEntity entity, PathFinder pathFinder)
entity
- The entity that will be navigated by this instancepathFinder
- The pathfinder that is used to navigate the entitypublic void addNavigationListener(NavigationListener listener)
public void removeNavigationListener(NavigationListener listener)
public void cancelNavigation(java.util.function.Predicate<IMobileEntity> predicate)
public IMobileEntity getEntity()
public Path getPath()
public PathFinder getPathFinder()
public float getAcceptableError()
public boolean isNavigating()
public boolean navigate(java.awt.geom.Path2D path)
public boolean navigate(java.awt.geom.Point2D target)
public void render(java.awt.Graphics2D g)
render
in interface IRenderable
public void rotateTowards(java.awt.geom.Point2D target)
public void setAcceptableError(float acceptableError)
public void stop()
public void update()
IUpdateable
update
in interface IUpdateable