public interface IEntity
Modifier and Type | Method and Description |
---|---|
EntityActionMap |
actions()
All registered actions of this entity.
|
void |
addController(IEntityController controller) |
void |
addEntityRenderListener(EntityRenderListener listener)
Adds the specified entity render listener to receive events and callbacks about the rendering process of entities.
|
void |
addListener(EntityListener listener) |
void |
addTag(java.lang.String tag) |
void |
addTransformListener(EntityTransformListener listener) |
IEntityAnimationController<?> |
animations()
Gets the entities animation controller.
|
void |
attachControllers() |
IBehaviorController |
behavior() |
void |
detachControllers() |
double |
getAngle() |
java.awt.geom.Rectangle2D |
getBoundingBox() |
java.awt.geom.Point2D |
getCenter() |
<T extends IEntityController> |
getController(java.lang.Class<T> clss) |
Environment |
getEnvironment()
Gets the environment the entity was loaded to or null if it is not loaded.
|
double |
getHeight() |
java.awt.geom.Point2D |
getLocation() |
int |
getMapId() |
java.lang.String |
getName()
Gets the name of this entity.
|
ICustomPropertyProvider |
getProperties() |
RenderType |
getRenderType() |
java.util.List<java.lang.String> |
getTags() |
double |
getWidth() |
double |
getX() |
double |
getY() |
boolean |
hasTag(java.lang.String tag) |
boolean |
isLoaded()
Indicates whether this entity is loaded on the currently active environment.
|
boolean |
isVisible() |
void |
loaded(Environment environment)
This method provides the possibility to implement behavior whenever this entity was added to the environment.
|
void |
onMessage(EntityMessageListener listener) |
void |
onMessage(java.lang.String message,
EntityMessageListener listener) |
void |
onRendered(EntityRenderedListener listener)
Adds the specified entity rendered listener to receive events when entities were rendered.
|
void |
perform(java.lang.String actionName)
Performs an
EntityAction that was previously registered for this entity. |
EntityAction |
register(java.lang.String name,
java.lang.Runnable action)
Registers an
EntityAction with the specified name. |
void |
removed(Environment environment)
This method provides the possibility to implement behavior whenever this entity was removed from the environment.
|
void |
removeEntityRenderedListener(EntityRenderedListener listener)
Removes the specified entity rendered listener.
|
void |
removeEntityRenderListener(EntityRenderListener listener)
Removes the specified entity render listener.
|
void |
removeListener(EntityListener listener) |
void |
removeMessageListener(EntityMessageListener listener) |
void |
removeTag(java.lang.String tag) |
void |
removeTransformListener(EntityTransformListener listener) |
boolean |
renderWithLayer()
Determines whether this entity is being rendered with the layer it's originating from.
|
java.lang.String |
sendMessage(java.lang.Object sender,
java.lang.String message) |
void |
setAngle(double angle)
Sets the angle (in degrees) in which the entity is directed.
|
<T extends IEntityController> |
setController(java.lang.Class<T> clss,
T controller) |
void |
setHeight(double height) |
void |
setLocation(double x,
double y) |
void |
setLocation(java.awt.geom.Point2D location)
Sets the map location.
|
void |
setMapId(int mapId)
Sets an id which should only be filled when an entity gets added due to map
information.
|
void |
setName(java.lang.String name) |
void |
setRenderType(RenderType renderType) |
void |
setRenderWithLayer(boolean renderWithLayer) |
void |
setSize(double width,
double height) |
void |
setVisible(boolean visible) |
void |
setWidth(double width) |
void |
setX(double x) |
void |
setY(double y) |
void onMessage(EntityMessageListener listener)
void onMessage(java.lang.String message, EntityMessageListener listener)
void removeMessageListener(EntityMessageListener listener)
void addTransformListener(EntityTransformListener listener)
void removeTransformListener(EntityTransformListener listener)
void addListener(EntityListener listener)
void removeListener(EntityListener listener)
void onRendered(EntityRenderedListener listener)
listener
- The listener to add.void removeEntityRenderedListener(EntityRenderedListener listener)
listener
- The listener to remove.void addEntityRenderListener(EntityRenderListener listener)
listener
- The listener to add.void removeEntityRenderListener(EntityRenderListener listener)
listener
- The listener to remove.double getAngle()
void setAngle(double angle)
angle
- the new angle in degreesIEntityAnimationController<?> animations()
RenderEngine.renderEntity(java.awt.Graphics2D, IEntity)
boolean isVisible()
void setVisible(boolean visible)
IBehaviorController behavior()
void addController(IEntityController controller)
<T extends IEntityController> void setController(java.lang.Class<T> clss, T controller)
<T extends IEntityController> T getController(java.lang.Class<T> clss)
EntityActionMap actions()
EntityActionMap
,
register(String, Runnable)
void perform(java.lang.String actionName)
EntityAction
that was previously registered for this entity.
Does nothing in case no action has been registered for the specified actionName
.
actionName
- The name of the action to be performed.actions()
,
register(String, Runnable)
EntityAction register(java.lang.String name, java.lang.Runnable action)
EntityAction
with the specified name.
It's later possible to execute these actions on the entity by using the Entity.perform(String actionName)
method.name
- The name of the action to be registered.action
- The action to be performed by the entity.perform(String)
,
actions()
void detachControllers()
void attachControllers()
java.awt.geom.Rectangle2D getBoundingBox()
java.awt.geom.Point2D getCenter()
double getHeight()
java.awt.geom.Point2D getLocation()
int getMapId()
java.lang.String getName()
RenderType getRenderType()
boolean renderWithLayer()
RenderType
and makes the entity dependent upon the visibility of it's layer.
This can only be used, of course, if the entity is related to a MapObject
.
This defaults to false
if not explicitly set on the MapObject
.
ILayer.isVisible()
,
IMapObjectLayer.getMapObjects()
,
Environment.getEntitiesByLayer(int)
,
Environment.getEntitiesByLayer(String)
double getWidth()
double getX()
double getY()
java.lang.String sendMessage(java.lang.Object sender, java.lang.String message)
void setHeight(double height)
void setLocation(double x, double y)
boolean hasTag(java.lang.String tag)
java.util.List<java.lang.String> getTags()
void addTag(java.lang.String tag)
void removeTag(java.lang.String tag)
void setLocation(java.awt.geom.Point2D location)
location
- the new map locationvoid setMapId(int mapId)
mapId
- The unique map ID for this IEntity
void setName(java.lang.String name)
void setRenderType(RenderType renderType)
void setRenderWithLayer(boolean renderWithLayer)
void setSize(double width, double height)
void setWidth(double width)
void setX(double x)
void setY(double y)
ICustomPropertyProvider getProperties()
Environment getEnvironment()
void loaded(Environment environment)
environment
- The environment that the entity was added toaddListener(EntityListener)
void removed(Environment environment)
environment
- The environment that the entity was removed fromaddListener(EntityListener)
boolean isLoaded()
GameWorld.environment()
,
loaded(Environment)
,
removed(Environment)