public class EntityNavigator extends java.lang.Object implements IEntityNavigator
| Constructor and Description |
|---|
EntityNavigator(IMobileEntity entity,
IPathFinder 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() |
IPathFinder |
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, IPathFinder pathFinder)
entity - The entity that will be navigated by this instancepathFinder - The pathfinder that is used to navigate the entitypublic void addNavigationListener(NavigationListener listener)
addNavigationListener in interface IEntityNavigatorpublic void removeNavigationListener(NavigationListener listener)
removeNavigationListener in interface IEntityNavigatorpublic void cancelNavigation(java.util.function.Predicate<IMobileEntity> predicate)
cancelNavigation in interface IEntityNavigatorpublic IMobileEntity getEntity()
getEntity in interface IEntityNavigatorpublic Path getPath()
getPath in interface IEntityNavigatorpublic IPathFinder getPathFinder()
getPathFinder in interface IEntityNavigatorpublic float getAcceptableError()
getAcceptableError in interface IEntityNavigatorpublic boolean isNavigating()
isNavigating in interface IEntityNavigatorpublic boolean navigate(java.awt.geom.Path2D path)
navigate in interface IEntityNavigatorpublic boolean navigate(java.awt.geom.Point2D target)
navigate in interface IEntityNavigatorpublic void render(java.awt.Graphics2D g)
render in interface IRenderablepublic void rotateTowards(java.awt.geom.Point2D target)
rotateTowards in interface IEntityNavigatorpublic void setAcceptableError(float acceptableError)
setAcceptableError in interface IEntityNavigatorpublic void stop()
stop in interface IEntityNavigatorpublic void update()
IUpdateableupdate in interface IUpdateable