R
- Resource enumeration type.T
- Tile type used.E
- Entity type used.C
- Control panel type.public abstract class HandlerEntityRts<R extends java.lang.Enum<R>,T extends TileRts<?,R>,E extends EntityRts,C extends ControlPanelModel<E>> extends com.b3dgs.lionengine.game.entity.HandlerEntityGame<E> implements ControlPanelListener
createLayers(MapTile)
after map creation (when its size is
established).Constructor and Description |
---|
HandlerEntityRts(CameraRts camera,
CursorRts cursor,
C panel,
MapTileRts<?,R,T> map)
Create a new entity handler.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(EntityRtsListener<E> listener)
Add an entity listener.
|
void |
createLayers(com.b3dgs.lionengine.game.map.MapTile<?,T> map)
Prepare rendering layers, depending of the map height.
|
E |
getClosestEntity(E from,
java.lang.Class<?> type,
boolean samePlayer)
Get the closest entity from its type.
|
E |
getEntityAt(int tx,
int ty)
Get the entity at the specified location in tile.
|
E |
getEntityAt(com.b3dgs.lionengine.game.Tiled location)
Get the entity at the specified location in tile.
|
java.util.Set<E> |
getSelection()
Get list of selected entries during cursor selection.
|
void |
notifySelectionDone(com.b3dgs.lionengine.Rectangle selection)
Notify when selection is done.
|
void |
notifySelectionStarted(com.b3dgs.lionengine.Rectangle selection)
Notify when selection started.
|
void |
render(com.b3dgs.lionengine.Graphic g) |
void |
setClickAssignment(int click)
Set the mouse click assignment.
|
void |
setPlayerId(int playerId)
Set player id (player id owning this panel).
|
void |
update(double extrp) |
public HandlerEntityRts(CameraRts camera, CursorRts cursor, C panel, MapTileRts<?,R,T> map)
createLayers(MapTile)
after map creation (when its
size is established).camera
- The camera viewpoint.cursor
- The cursor reference (used for selection).panel
- The control panel reference.map
- The map reference.public void addListener(EntityRtsListener<E> listener)
listener
- Entity listener.public void createLayers(com.b3dgs.lionengine.game.map.MapTile<?,T> map)
map
- The map reference.public void setClickAssignment(int click)
click
- The mouse click value.public void setPlayerId(int playerId)
playerId
- The player id.public E getEntityAt(com.b3dgs.lionengine.game.Tiled location) throws EntityNotFoundException
location
- The location.EntityNotFoundException
- Thrown if no entity is found at this location.public E getEntityAt(int tx, int ty) throws EntityNotFoundException
tx
- The horizontal tile.ty
- The vertical tile.EntityNotFoundException
- Thrown if no entity is found at this location.public E getClosestEntity(E from, java.lang.Class<?> type, boolean samePlayer) throws EntityNotFoundException
from
- The entity source (from which entity to search).type
- The entity class type to find (used as filter).samePlayer
- true
if returned reference has to be owned by the same player as the entity from,
false
else.EntityNotFoundException
- If no entity was found.public java.util.Set<E> getSelection()
public void update(double extrp)
public void render(com.b3dgs.lionengine.Graphic g)
public void notifySelectionStarted(com.b3dgs.lionengine.Rectangle selection)
ControlPanelListener
notifySelectionStarted
in interface ControlPanelListener
selection
- The selection.public void notifySelectionDone(com.b3dgs.lionengine.Rectangle selection)
ControlPanelListener
notifySelectionDone
in interface ControlPanelListener
selection
- The selection.