Class EntityNavigator
java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.EntityNavigator
- All Implemented Interfaces:
IRenderable
,IUpdateable
public class EntityNavigator
extends java.lang.Object
implements IUpdateable, IRenderable
Constructor Summary
Constructors Constructor Description EntityNavigator(IMobileEntity entity, PathFinder pathFinder)
Instantiates a new entity navigator.Method Summary
Modifier and Type Method 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)
Renders the visual contents of this instance onto the provided graphics context.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 are attached to the loop.
Constructor Details
EntityNavigator
Instantiates a new entity navigator.- Parameters:
entity
- The entity that will be navigated by this instancepathFinder
- The pathfinder that is used to navigate the entity
Method Details
addNavigationListener
removeNavigationListener
cancelNavigation
getEntity
getPath
getPathFinder
getAcceptableError
public float getAcceptableError()isNavigating
public boolean isNavigating()navigate
public boolean navigate(java.awt.geom.Path2D path)navigate
public boolean navigate(java.awt.geom.Point2D target)render
public void render(java.awt.Graphics2D g)Description copied from interface:IRenderable
Renders the visual contents of this instance onto the provided graphics context.If an
Entity
implements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
render
in interfaceIRenderable
- Parameters:
g
- The current graphics object onto which this instance will render its visual contents.- See Also:
RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
rotateTowards
public void rotateTowards(java.awt.geom.Point2D target)setAcceptableError
public void setAcceptableError(float acceptableError)stop
public void stop()update
public void update()Description copied from interface:IUpdateable
This method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using theClientConfiguration
.- Specified by:
update
in interfaceIUpdateable
- See Also:
ClientConfiguration.setMaxFps(int)